# KSave
`ksave.py` is a command-line interface (CLI) tool for backing up Kubernetes objects in YAML format. It supports various Kubernetes object types, such as Pods, Deployments, DaemonSets, Secrets, and more ...
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)
![Architecture](readme-files/ksave_architecture.png)
## Usage
### Command:
```bash
ksave.py <object_type> <object_name> [options] > <output_file>
```
### Supported Object Types:
-`pods`: Back up your Kubernetes Pod objects
-`deployments`: Back up your Kubernetes Deployments objects
-`daemonsets`: Back up your Kubernetes Daemonsets objects
-`statefulsets`: Back up your Kubernetes Statefulsets objects
-`cronjobs`: Back up your Kubernetes CronJob objects
-`jobs`: Back up your Kubernetes Job objects
-`secrets`: Back up your Kubernetes Secrets objects
-`configmaps`: Back up your Kubernetes ConfigMap objects
-`ingress`: Back up your Kubernetes Ingress objects
-`services`: Back up your Kubernetes Services objects
-`storageclass`: Back up your Kubernetes StorageClass objects
-`persistentvolumes`: Back up your Kubernetes PersistentVolume objects
-`peristentvolumeclaims`: Back up your Kubernetes PersistentVolumeClaim objects
-`serviceaccount`: Back up your Kubernetes ServiceAccount objects
-`roles`: Back up your Kubernetes Role objects
-`rolebindings`: Back up your Kubernetes RoleBinding objects
-`clusterroles`: Back up your Kubernetes ClusterRole objects
-`clusterrolebindings`: Back up your Kubernetes ClusterRoleBinding objects
### Options:
- `--namespace <namespace>`: Specify the namespace of the Kubernetes object.
- `--all`: Backup objects from all namespaces.
### Examples:
To backup a specific Pod object:
```bash
ksave.py pods my_pod > my_pod.backup.yaml
```
To backup a Deployment object in a specific namespace:
```bash
ksave.py deployments my_deployment --namespace my_namespace > my_deployment.my_namespace.backup.yaml
```
To backup all DaemonSet objects:
```bash
ksave.py daemonsets --all > all_daemonsets.backup.yaml
```
To backup a Secret object:
```bash
ksave.py secrets my_secret > my_secret.backup.yaml
```
### Help:
To display this help message and see all available options, use the `--help` flag:
```bash
ksave.py --help
```
### Sample --help Output:
```plaintext
Usage: ksave [-h] {pods,deployments,daemonsets,statefulsets,cronjobs,jobs,secrets,configmaps,ingress,services,storageclass,persistentvolumes,peristentvolumeclaims,serviceaccount,roles,rolebindings,clusterroles,clusterrolebindings} ...
positional arguments:
{pods,deployments,daemonsets,statefulsets,cronjobs,jobs,secrets,configmaps,ingress,services,storageclass,persistentvolumes,peristentvolumeclaims,serviceaccount,roles,rolebindings,clusterroles,clusterrolebindings}
sub-command help
pods Back up your Kubernetes Pod objects
deployments Back up your Kubernetes Deployments objects
daemonsets Back up your Kubernetes Daemonsets objects
statefulsets Back up your Kubernetes Statefulsets objects
cronjobs Back up your Kubernetes CronJob objects
jobs Back up your Kubernetes Job objects
secrets Back up your Kubernetes Secrets objects
configmaps Back up your Kubernetes ConfigMap objects
ingress Back up your Kubernetes Ingress objects
services Back up your Kubernetes Services objects
storageclass Back up your Kubernetes StorageClass objects
persistentvolumes Back up your Kubernetes PersistentVolume objects
peristentvolumeclaims
Back up your Kubernetes PersistentVolumeClaim objects
serviceaccount Back up your Kubernetes ServiceAccount objects
roles Back up your Kubernetes Role objects
rolebindings Back up your Kubernetes RoleBinding objects
clusterroles Back up your Kubernetes ClusterRole objects
clusterrolebindings
Back up your Kubernetes ClusterRoleBinding objects
options:
-h, --help show this help message and exit
```
## Installation
To activate individual virtual environment:
```bash
pip install virtualenv
```
To create and start in project root:
```bash
virtualenv venv
source venv/bin/activate
```
Install dependencies in virtual environment:
```bash
pip install -r requirements.txt
```
## Documentation
In this project, the [Kubernetes Python Client](https://github.com/kubernetes-client/python) proposed by kubernetes.io was used.
Kubernetes Python Client API Endpoint List -- [Referance List](https://github.com/kubernetes-client/python/blob/36cfbe68a509d9b9d33395b22b6fa94d7d46c30f/kubernetes/README.md)
This CLI application is coded with [arge-parse ](https://github.com/serbayacar/passkeepPy/blob/master/LICENSE.gpl).
Raw data
{
"_id": null,
"home_page": "https://github.com/serbayacar/ksave",
"name": "ksave",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "your.email@example.com",
"download_url": "https://files.pythonhosted.org/packages/96/4d/02d5abdc82d07e543e8ecf62d3636bf9f4996d25cdd91faf459415197122/ksave-0.1.1.tar.gz",
"platform": null,
"description": "# KSave\n\n`ksave.py` is a command-line interface (CLI) tool for backing up Kubernetes objects in YAML format. It supports various Kubernetes object types, such as Pods, Deployments, DaemonSets, Secrets, and more ...\n\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n\n![Architecture](readme-files/ksave_architecture.png)\n\n## Usage\n\n### Command:\n\n```bash\nksave.py <object_type> <object_name> [options] > <output_file>\n```\n\n### Supported Object Types:\n\n-`pods`: Back up your Kubernetes Pod objects \n-`deployments`: Back up your Kubernetes Deployments objects \n-`daemonsets`: Back up your Kubernetes Daemonsets objects \n-`statefulsets`: Back up your Kubernetes Statefulsets objects \n-`cronjobs`: Back up your Kubernetes CronJob objects \n-`jobs`: Back up your Kubernetes Job objects \n-`secrets`: Back up your Kubernetes Secrets objects \n-`configmaps`: Back up your Kubernetes ConfigMap objects \n-`ingress`: Back up your Kubernetes Ingress objects \n-`services`: Back up your Kubernetes Services objects \n-`storageclass`: Back up your Kubernetes StorageClass objects \n-`persistentvolumes`: Back up your Kubernetes PersistentVolume objects \n-`peristentvolumeclaims`: Back up your Kubernetes PersistentVolumeClaim objects \n-`serviceaccount`: Back up your Kubernetes ServiceAccount objects \n-`roles`: Back up your Kubernetes Role objects \n-`rolebindings`: Back up your Kubernetes RoleBinding objects \n-`clusterroles`: Back up your Kubernetes ClusterRole objects \n-`clusterrolebindings`: Back up your Kubernetes ClusterRoleBinding objects \n\n### Options:\n\n- `--namespace <namespace>`: Specify the namespace of the Kubernetes object.\n- `--all`: Backup objects from all namespaces.\n\n\n### Examples:\n\n To backup a specific Pod object:\n\n```bash\nksave.py pods my_pod > my_pod.backup.yaml\n```\n\n To backup a Deployment object in a specific namespace:\n\n```bash\nksave.py deployments my_deployment --namespace my_namespace > my_deployment.my_namespace.backup.yaml\n```\n\n To backup all DaemonSet objects:\n\n```bash\nksave.py daemonsets --all > all_daemonsets.backup.yaml\n```\n\n To backup a Secret object:\n\n```bash\nksave.py secrets my_secret > my_secret.backup.yaml\n```\n\n### Help:\n\nTo display this help message and see all available options, use the `--help` flag:\n\n```bash\nksave.py --help\n```\n\n### Sample --help Output:\n\n```plaintext\nUsage: ksave [-h] {pods,deployments,daemonsets,statefulsets,cronjobs,jobs,secrets,configmaps,ingress,services,storageclass,persistentvolumes,peristentvolumeclaims,serviceaccount,roles,rolebindings,clusterroles,clusterrolebindings} ...\n\npositional arguments:\n {pods,deployments,daemonsets,statefulsets,cronjobs,jobs,secrets,configmaps,ingress,services,storageclass,persistentvolumes,peristentvolumeclaims,serviceaccount,roles,rolebindings,clusterroles,clusterrolebindings}\n sub-command help\n pods Back up your Kubernetes Pod objects\n deployments Back up your Kubernetes Deployments objects\n daemonsets Back up your Kubernetes Daemonsets objects\n statefulsets Back up your Kubernetes Statefulsets objects\n cronjobs Back up your Kubernetes CronJob objects\n jobs Back up your Kubernetes Job objects\n secrets Back up your Kubernetes Secrets objects\n configmaps Back up your Kubernetes ConfigMap objects\n ingress Back up your Kubernetes Ingress objects\n services Back up your Kubernetes Services objects\n storageclass Back up your Kubernetes StorageClass objects\n persistentvolumes Back up your Kubernetes PersistentVolume objects\n peristentvolumeclaims\n Back up your Kubernetes PersistentVolumeClaim objects\n serviceaccount Back up your Kubernetes ServiceAccount objects\n roles Back up your Kubernetes Role objects\n rolebindings Back up your Kubernetes RoleBinding objects\n clusterroles Back up your Kubernetes ClusterRole objects\n clusterrolebindings\n Back up your Kubernetes ClusterRoleBinding objects\n\noptions:\n -h, --help show this help message and exit\n```\n\n## Installation\n\nTo activate individual virtual environment:\n\n```bash\npip install virtualenv \n```\n\nTo create and start in project root:\n\n```bash\nvirtualenv venv\nsource venv/bin/activate\n```\n\nInstall dependencies in virtual environment:\n\n```bash\npip install -r requirements.txt\n```\n\n## Documentation\n\nIn this project, the [Kubernetes Python Client](https://github.com/kubernetes-client/python) proposed by kubernetes.io was used. \nKubernetes Python Client API Endpoint List -- [Referance List](https://github.com/kubernetes-client/python/blob/36cfbe68a509d9b9d33395b22b6fa94d7d46c30f/kubernetes/README.md) \nThis CLI application is coded with [arge-parse ](https://github.com/serbayacar/passkeepPy/blob/master/LICENSE.gpl).\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool to backup Kubernetes YAML configurations.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/serbayacar/ksave"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6de68e031c5a1734ee46e425d7866e6a96ffce61d7eb6f5f1a1ab066efd6ce57",
"md5": "1184ed6b4be39116acf0b91fbf8d49bd",
"sha256": "7f0c8b121e86f9995dc67e3b28737a0ad1ee055b1971d20fd111593c843708d1"
},
"downloads": -1,
"filename": "ksave-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1184ed6b4be39116acf0b91fbf8d49bd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3522,
"upload_time": "2024-05-17T21:48:47",
"upload_time_iso_8601": "2024-05-17T21:48:47.019123Z",
"url": "https://files.pythonhosted.org/packages/6d/e6/8e031c5a1734ee46e425d7866e6a96ffce61d7eb6f5f1a1ab066efd6ce57/ksave-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "964d02d5abdc82d07e543e8ecf62d3636bf9f4996d25cdd91faf459415197122",
"md5": "7a26cf5eed67cea575f3615d63a66ad7",
"sha256": "9fe32efb4c49b11ffdd6ea4d31bd8771c0eb7b748204219bd8352b2008e7248c"
},
"downloads": -1,
"filename": "ksave-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "7a26cf5eed67cea575f3615d63a66ad7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3517,
"upload_time": "2024-05-17T21:48:48",
"upload_time_iso_8601": "2024-05-17T21:48:48.171462Z",
"url": "https://files.pythonhosted.org/packages/96/4d/02d5abdc82d07e543e8ecf62d3636bf9f4996d25cdd91faf459415197122/ksave-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 21:48:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "serbayacar",
"github_project": "ksave",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "kubernetes",
"specs": [
[
"==",
"28.1.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
}
],
"lcname": "ksave"
}