{"id":15178847,"url":"https://github.com/shadyosama9/fastapi-kubernetes-deployment-manager","last_synced_at":"2026-03-01T15:32:15.541Z","repository":{"id":248408423,"uuid":"828605457","full_name":"shadyosama9/FastAPI-Kubernetes-Deployment-Manager","owner":"shadyosama9","description":"A FastAPI application to manage Kubernetes deployments and fetch Prometheus metrics. This application provides RESTful endpoints to create Kubernetes deployments and retrieve pod details from Prometheus.","archived":false,"fork":false,"pushed_at":"2024-07-14T16:49:42.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-05T11:42:40.135Z","etag":null,"topics":["docker","fastapi","grafana","kubernetes","prometheus","python","restful-api"],"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/shadyosama9.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}},"created_at":"2024-07-14T16:42:25.000Z","updated_at":"2024-07-14T16:50:49.000Z","dependencies_parsed_at":"2024-07-14T18:38:38.035Z","dependency_job_id":null,"html_url":"https://github.com/shadyosama9/FastAPI-Kubernetes-Deployment-Manager","commit_stats":null,"previous_names":["shadyosama9/fastapi-kubernetes-deployment-manager"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadyosama9%2FFastAPI-Kubernetes-Deployment-Manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadyosama9%2FFastAPI-Kubernetes-Deployment-Manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadyosama9%2FFastAPI-Kubernetes-Deployment-Manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadyosama9%2FFastAPI-Kubernetes-Deployment-Manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadyosama9","download_url":"https://codeload.github.com/shadyosama9/FastAPI-Kubernetes-Deployment-Manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240366012,"owners_count":19790009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","fastapi","grafana","kubernetes","prometheus","python","restful-api"],"created_at":"2024-09-27T15:40:18.968Z","updated_at":"2026-03-01T15:32:15.503Z","avatar_url":"https://github.com/shadyosama9.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Kubernetes Deployment Manager\n\nA FastAPI application to manage Kubernetes deployments and fetch Prometheus metrics. This application provides RESTful endpoints to create Kubernetes deployments and retrieve pod details from Prometheus.\n\n## Overview\n\nThis project demonstrates how to:\n- Use FastAPI to create RESTful endpoints.\n- Deploy a FastAPI application on Kubernetes.\n- Create Kubernetes deployments programmatically using the Kubernetes Python client.\n- Fetch and display metrics from Prometheus.\n\nThe FastAPI application includes the following endpoints:\n- `POST /createdeployment/{deployment_name}`: Create a new Kubernetes deployment with the specified name.\n- `GET /getpromdetails`: Fetch and display pod details from Prometheus.\n\n## Prerequisites\n\n- **Docker**: To build and run Docker containers.\n- **Kubernetes**: A running Kubernetes cluster.\n- **kubectl**: Command-line tool for interacting with the Kubernetes cluster.\n- **Prometheus**: A running Prometheus instance accessible from the Kubernetes cluster.\n- **Python 3.10**: For running the FastAPI application locally.\n\n## Steps\n\n1. **Clone the repository**\n    ```bash\n    git clone https://github.com/yourusername/fastapi-k8s-deployment-manager.git\n    cd fastapi-k8s-deployment-manager\n    ```\n\n2. **Set up environment variables**\n    - Create a `.env` file in the root of your project with the following content:\n      ```env\n      PROMETHEUS_URL=http://\u003cyour-prometheus-url\u003e\n      ```\n\n3. **Build the Docker image**\n    ```bash\n    docker build -t fastapi-k8s-deployment-manager .\n    ```\n\n4. **Push the Docker image to Docker Hub (optional)**\n    ```bash\n    docker tag fastapi-k8s-deployment-manager yourusername/fastapi-k8s-deployment-manager\n    docker push yourusername/fastapi-k8s-deployment-manager\n    ```\n\n5. **Apply Kubernetes configurations**\n\n    - Apply RBAC configuration\n      ```bash\n      kubectl apply -f k8s/rbac.yaml\n      ```\n\n    - Deploy the FastAPI application\n      ```bash\n      kubectl apply -f k8s/deployment.yaml\n      ```\n\n    - Expose the FastAPI application using a service\n      ```bash\n      kubectl apply -f k8s/service.yaml\n      ```\n\n6. **Access the FastAPI application**\n\n    - Get the NodePort of the service\n      ```bash\n      kubectl get svc fast-api-service\n      ```\n    - Access the application at `http://\u003cnode-ip\u003e:\u003cnode-port\u003e`\n\n7. **Use the FastAPI application**\n\n    - Create a new Kubernetes deployment\n      ```bash\n      curl -X POST http://\u003cnode-ip\u003e:\u003cnode-port\u003e/createdeployment/{deployment_name}\n      ```\n\n    - Fetch pod details from Prometheus\n      ```bash\n      curl http://\u003cnode-ip\u003e:\u003cnode-port\u003e/getpromdetails\n      ```\n\n## Notes\n\n- Ensure your Prometheus instance is running and accessible from the Kubernetes cluster.\n- Customize the Kubernetes deployment and service configurations as needed.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadyosama9%2Ffastapi-kubernetes-deployment-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadyosama9%2Ffastapi-kubernetes-deployment-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadyosama9%2Ffastapi-kubernetes-deployment-manager/lists"}