@@ -26,6 +26,110 @@ It integrates smoothly with Kubernetes clusters and can be deployed as a contain
2626
2727---
2828
29+ ## Prerequisites
30+
31+ Before deploying, ensure you have the following tools installed:
32+ - ` kubectl `
33+ - ` jq `
34+ - ` sed `
35+ - An Ingress Controller (e.g., Nginx, Traefik) is recommended for external access.
36+
37+ ---
38+
39+ ## Configuration
40+
41+ The deployment script and application require specific environment variables to be set.
42+
43+ | Variable | Description | Required |
44+ | ----------| -------------| ----------|
45+ | ` OBJECT_STORE_REQ ` | The target URL for uploading snapshots via HTTP PUT (e.g., ` https://objectstorage.us-region.oraclecloud.com/p/... ` ). | ** Yes** |
46+ | ` SF_API_KEY ` | A secure key used to authenticate API requests. | ** Yes** |
47+ | ` NAMESPACE ` | The Kubernetes namespace to deploy into. Defaults to ` kubesnap ` . | No |
48+
49+ ---
50+
51+ ## Installation
52+
53+ 1 . ** Clone the repository**
54+ ``` bash
55+ git clone https://github.com/tekpeek/kubesnap.git
56+ cd kubesnap
57+ ```
58+
59+ 2 . ** Set Environment Variables**
60+ Export the required variables before running the deployment script.
61+ ``` bash
62+ export OBJECT_STORE_REQ=" <YOUR_OBJECT_STORAGE_PUT_URL>"
63+ export SF_API_KEY=" <YOUR_SECURE_API_KEY>"
64+ # Optional: Custom namespace
65+ export NAMESPACE=" kubesnap"
66+ ```
67+
68+ 3 . ** Deploy**
69+ Give execute permissions and run the deployment script.
70+ ``` bash
71+ chmod +x deploy_project.sh
72+ ./deploy_project.sh
73+ ```
74+
75+ ---
76+
77+ ## API Reference
78+
79+ Once deployed, you can interact with ** kubesnap** using its REST API.
80+
81+ ### Authentication
82+ All requests to the snapshot endpoint require the ` X-API-Key ` header.
83+ ``` bash
84+ -H " X-API-Key: <YOUR_SF_API_KEY>"
85+ ```
86+
87+ ### Endpoints
88+
89+ #### 1. Health Check
90+ Check if the service is running.
91+ - ** URL:** ` /api/kubesnap/health `
92+ - ** Method:** ` GET `
93+ - ** Response:**
94+ ``` json
95+ {
96+ "status" : " OK" ,
97+ "timestamp" : " 2023-10-27 10:00:00+00:00"
98+ }
99+ ```
100+
101+ #### 2. Create Snapshot
102+ Trigger a snapshot for a specific namespace.
103+ - ** URL:** ` /api/kubesnap/{namespace} `
104+ - ** Method:** ` GET `
105+ - ** Headers:** ` X-API-Key: <SF_API_KEY> `
106+ - ** Response:**
107+ ``` json
108+ {
109+ "snapshot_status" : " success" ,
110+ "file_name" : " kubesnap_2023_10_27_10_00_00.zip" ,
111+ "timestamp" : " 1698400800.0" ,
112+ "upload_status" : " success"
113+ }
114+ ```
115+
116+ ---
117+
118+ ## Snapshot Artifacts
119+
120+ The generated snapshot is a ` .zip ` file containing the following structure:
121+
122+ ```
123+ kubesnap_<timestamp>.zip
124+ ├── pod_logs/ # Logs from all pods in the namespace
125+ ├── deployments/ # YAML configurations of deployments
126+ ├── jobs/ # YAML configurations of jobs
127+ ├── cronjobs/ # YAML configurations of cronjobs
128+ └── configmaps/ # YAML configurations of configmaps
129+ ```
130+
131+ ---
132+
29133## 📂 Project Structure
30134
31135```
@@ -51,15 +155,4 @@ kubesnap/
51155└── .github/workflows/
52156 ├── build.yml # CI build workflow
53157 └── deploy.yml # CD deployment workflow
54- ```
55-
56- # Installation
57-
58- - Clone the repository
59- - Enter the kubesnap repository
60- - In case you want to deploy kubesnap to a custom namespace, run the command
61- - ` export NAMESPACE="<CUSTOM-NAMESPACE>" `
62- - Give execute permissions to the file
63- - ` chmod +x deploy_project.sh `
64- - Run the file
65- - ` ./deploy_project.sh `
158+ ```
0 commit comments