{"id":43976122,"url":"https://github.com/tekpeek/kubesnap","last_synced_at":"2026-02-07T08:09:45.973Z","repository":{"id":313620154,"uuid":"1045468128","full_name":"tekpeek/kubesnap","owner":"tekpeek","description":"A microservice for taking log snapshot of all pods, jobs, deployments, cronjobs, configmaps and push them to object storage.","archived":false,"fork":false,"pushed_at":"2025-11-30T06:42:07.000Z","size":280,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-02T11:20:33.959Z","etag":null,"topics":["devops-tools","kubernetes-cluster","kubernetes-deployment","logging","objectstorage"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tekpeek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-27T08:10:55.000Z","updated_at":"2025-11-30T06:42:11.000Z","dependencies_parsed_at":"2025-09-07T11:49:40.546Z","dependency_job_id":"fa077546-cd12-4a73-9973-a808dcb989e1","html_url":"https://github.com/tekpeek/kubesnap","commit_stats":null,"previous_names":["tekpeek/kubesnap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tekpeek/kubesnap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekpeek%2Fkubesnap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekpeek%2Fkubesnap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekpeek%2Fkubesnap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekpeek%2Fkubesnap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tekpeek","download_url":"https://codeload.github.com/tekpeek/kubesnap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekpeek%2Fkubesnap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29189675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops-tools","kubernetes-cluster","kubernetes-deployment","logging","objectstorage"],"created_at":"2026-02-07T08:09:45.858Z","updated_at":"2026-02-07T08:09:45.968Z","avatar_url":"https://github.com/tekpeek.png","language":"Python","readme":"# kubesnap  \n\nTake consistent Kubernetes snapshots of cluster resources and push them to object storage.  \n\n[![Build](https://github.com/tekpeek/kubesnap/actions/workflows/build.yml/badge.svg)](./.github/workflows/build.yml)  \n[![Deploy](https://github.com/tekpeek/kubesnap/actions/workflows/deploy.yml/badge.svg)](./.github/workflows/deploy.yml)  \n\n---\n\n## Overview  \n\n**kubesnap** is a lightweight microservice designed to capture **snapshots of Kubernetes workloads** (pods, jobs, cronjobs, deployments, and services) and push them into an object storage bucket for archival, compliance, and debugging purposes.  \n\nIt integrates smoothly with Kubernetes clusters and can be deployed as a containerized service with proper RBAC and API access.  \n\n---\n\n## Features  \n\n- Collects runtime information of **pods, jobs, cronjobs, deployments, services**  \n- Pushes snapshot data to **Object Storage** (OCI or any S3-compatible backend)  \n- Supports **scheduled snapshots** via CronJobs  \n- Secured with **Kubernetes RBAC** and service accounts  \n- Delivered as a **Docker container** and easily deployed on any Kubernetes cluster  \n- GitHub Actions workflows for **CI/CD** (build \u0026 deploy pipelines)  \n\n---\n\n## Prerequisites\n\nBefore deploying, ensure you have the following tools installed:\n- `kubectl`\n- `jq`\n- `sed`\n- An Ingress Controller (e.g., Nginx, Traefik) is recommended for external access.\n\n---\n\n## Configuration\n\nThe deployment script and application require specific environment variables to be set.\n\n| Variable | Description | Required |\n|----------|-------------|----------|\n| `OBJECT_STORE_REQ` | The target URL for uploading snapshots via HTTP PUT (e.g., `https://objectstorage.us-region.oraclecloud.com/p/...`). | **Yes** |\n| `SF_API_KEY` | A secure key used to authenticate API requests. | **Yes** |\n| `NAMESPACE` | The Kubernetes namespace to deploy into. Defaults to `kubesnap`. | No |\n\n---\n\n## Installation\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/tekpeek/kubesnap.git\n   cd kubesnap\n   ```\n\n2. **Set Environment Variables**\n   Export the required variables before running the deployment script.\n   ```bash\n   export OBJECT_STORE_REQ=\"\u003cYOUR_OBJECT_STORAGE_PUT_URL\u003e\"\n   export SF_API_KEY=\"\u003cYOUR_SECURE_API_KEY\u003e\"\n   # Optional: Custom namespace\n   export NAMESPACE=\"kubesnap\"\n   ```\n\n3. **Deploy**\n   Give execute permissions and run the deployment script.\n   ```bash\n   chmod +x deploy_project.sh\n   ./deploy_project.sh\n   ```\n\n---\n\n## API Reference\n\nOnce deployed, you can interact with **kubesnap** using its REST API.\n\n### Authentication\nAll requests to the snapshot endpoint require the `X-API-Key` header.\n```bash\n-H \"X-API-Key: \u003cYOUR_SF_API_KEY\u003e\"\n```\n\n### Endpoints\n\n#### 1. Health Check\nCheck if the service is running.\n- **URL:** `/api/kubesnap/health`\n- **Method:** `GET`\n- **Response:**\n  ```json\n  {\n    \"status\": \"OK\",\n    \"timestamp\": \"2023-10-27 10:00:00+00:00\"\n  }\n  ```\n\n#### 2. Create Snapshot\nTrigger a snapshot for a specific namespace.\n- **URL:** `/api/kubesnap/{namespace}`\n- **Method:** `GET`\n- **Headers:** `X-API-Key: \u003cSF_API_KEY\u003e`\n- **Response:**\n  ```json\n  {\n    \"snapshot_status\": \"success\",\n    \"file_name\": \"kubesnap_2023_10_27_10_00_00.zip\",\n    \"timestamp\": \"1698400800.0\",\n    \"upload_status\": \"success\"\n  }\n  ```\n\n---\n\n## Snapshot Artifacts\n\nThe generated snapshot is a `.zip` file containing the following structure:\n\n```\nkubesnap_\u003ctimestamp\u003e.zip\n├── pod_logs/       # Logs from all pods in the namespace\n├── deployments/    # YAML configurations of deployments\n├── jobs/           # YAML configurations of jobs\n├── cronjobs/       # YAML configurations of cronjobs\n└── configmaps/     # YAML configurations of configmaps\n```\n\n---\n\n## 📂 Project Structure  \n\n```\nkubesnap/\n├── deploy_project.sh           # Deployment helper script\n├── dockerfiles/\n│   └── Dockerfile.kubesnap    # Container build file\n├── kubernetes/\n│   ├── deployments/\n│   │   └── kubesnap-deployment.yaml\n│   ├── rbac/\n│   │   ├── kubesnap-svc-acc.yaml\n│   │   ├── role-binding.yaml\n│   │   └── svc-acc-cluster-role.yaml\n│   └── services/\n│       ├── kubesnap-svc.yaml\n│       └── kubesnap-ingress.yaml\n├── src/\n│   ├── api/\n│   │   └── kubesnap.py              # API entrypoint\n│   └── core/\n│       └── kubesnap_functions.py   # Core logic for snapshots\n└── .github/workflows/\n    ├── build.yml                   # CI build workflow\n    └── deploy.yml                  # CD deployment workflow\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekpeek%2Fkubesnap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftekpeek%2Fkubesnap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekpeek%2Fkubesnap/lists"}