{"id":23906829,"url":"https://github.com/tks-devops/k8s-deployment-project","last_synced_at":"2026-02-07T07:32:58.867Z","repository":{"id":269531868,"uuid":"907707292","full_name":"Tks-Devops/k8s-deployment-project","owner":"Tks-Devops","description":"k8s project using git github docker k8s yaml ","archived":false,"fork":false,"pushed_at":"2024-12-26T17:58:33.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T17:57:40.588Z","etag":null,"topics":["aws-ec2","cicd","docker-image","dockerfile","git","github","jenkins","jenkinspipeline","k8s","kubectl","kubernetes","kubernetes-deployment","linux","minikube-commands","minikube-docker-deployment","minikube-setup","shell-scripts","yaml-configuration","yaml-files"],"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/Tks-Devops.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}},"created_at":"2024-12-24T07:41:07.000Z","updated_at":"2024-12-26T17:58:36.000Z","dependencies_parsed_at":"2024-12-24T08:35:17.297Z","dependency_job_id":"739d7cb4-ac29-44aa-998e-e2cb3a876797","html_url":"https://github.com/Tks-Devops/k8s-deployment-project","commit_stats":null,"previous_names":["tks-devops/k8s-deployment-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Tks-Devops/k8s-deployment-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tks-Devops%2Fk8s-deployment-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tks-Devops%2Fk8s-deployment-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tks-Devops%2Fk8s-deployment-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tks-Devops%2Fk8s-deployment-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tks-Devops","download_url":"https://codeload.github.com/Tks-Devops/k8s-deployment-project/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tks-Devops%2Fk8s-deployment-project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29189340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","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":["aws-ec2","cicd","docker-image","dockerfile","git","github","jenkins","jenkinspipeline","k8s","kubectl","kubernetes","kubernetes-deployment","linux","minikube-commands","minikube-docker-deployment","minikube-setup","shell-scripts","yaml-configuration","yaml-files"],"created_at":"2025-01-05T02:14:54.529Z","updated_at":"2026-02-07T07:32:58.862Z","avatar_url":"https://github.com/Tks-Devops.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Markdown\n\n# Python App Deployment on Kubernetes\n\nThis project demonstrates how to deploy a Python application on a Kubernetes cluster using Docker, Kubernetes YAML files, and Jenkins for CI/CD automation.\n\n## Project Overview\n\nThe project includes:\n\n- A Python script (`app.py`).\n- A Dockerfile to containerize the application.\n- Kubernetes YAML files for deployment, service, and horizontal pod autoscaling.\n- A Jenkins pipeline script for automating the build and deployment process.\n\n## Prerequisites\n\n- AWS Free Tier account with an EC2 instance.\n- Minikube or any Kubernetes cluster.\n- Docker installed on the system.\n- Jenkins set up for CI/CD.\n- Git installed on the system.\n\n## Steps to Set Up the Project\n\n### 1. Python Script\n\nSave the following Python script as `app.py`:\n\n```python\n# app.py\nprint(\"Hello, Kubernetes!\")\n\n2. Dockerfile\n\nCreate a Dockerfile to containerize the Python application:\nDockerfile\n\nFROM python:3.7-slim\nWORKDIR /app\nCOPY app.py .\nCMD [\"python\", \"app.py\"]\n\n3. Kubernetes YAML Files\nDeployment\nYAML\n\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: python-app\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: python-app\n  template:\n    metadata:\n      labels:\n        app: python-app\n    spec:\n      containers:\n      - name: python-app\n        image: \u003cyour-docker-image\u003e:\u003cbuild-number\u003e\n        ports:\n        - containerPort: 5000\n\nService\nYAML\n\napiVersion: v1\nkind: Service\nmetadata:\n  name: python-app-service\nspec:\n  selector:\n    app: python-app\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 5000\n  type: LoadBalancer\n\nHorizontal Pod Autoscaler\nYAML\n\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: python-app-hpa\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: python-app\n  minReplicas: 1\n  maxReplicas: 5\n  metrics:\n    - type: Resource\n      resource:\n        name: cpu\n        target:\n          type: Utilization\n          averageUtilization: 50\n\n4. Jenkins Pipeline Script\n\nAutomate the build and deployment process with the following Jenkins pipeline script:\nGroovy\n\npipeline {\n    agent any\n\n    environment {\n        DOCKER_IMAGE = \"your-docker-image\"\n        DOCKER_REGISTRY = \"your-docker-registry\"\n        BUILD_NUMBER = \"${BUILD_NUMBER}\"\n    }\n\n    stages {\n        stage('Clone Repository') {\n            steps {\n                git 'https://github.com/your-username/your-repository.git'\n            }\n        }\n\n        stage('Build Docker Image') {\n            steps {\n                script {\n                    sh 'docker build -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} .'\n                }\n            }\n        }\n\n        stage('Push Docker Image') {\n            steps {\n                script {\n                    sh 'docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}'\n                }\n            }\n        }\n\n        stage('Deploy to Kubernetes') {\n            steps {\n                script {\n                    sh 'kubectl apply -f deployment.yaml'\n                    sh 'kubectl apply -f service.yaml'\n                    sh 'kubectl apply -f hpa.yaml'\n                }\n            }\n        }\n    }\n}\n\n1 vulnerability detected\n\nSteps to Deploy\n\n    Clone this repository:\n\nbash\n\ngit clone https://github.com/your-username/your-repository.git\ncd your-repository\n\n    Build the Docker image:\n\ndocker build -t \u003cyour-docker-image\u003e:\u003cbuild-number\u003e .\n\n    Push the Docker image to a registry:\n\ndocker push \u003cyour-docker-image\u003e:\u003cbuild-number\u003e\n\n    Apply the Kubernetes YAML files:\n\nbash\n\nkubectl apply -f deployment.yaml\nkubectl apply -f service.yaml\nkubectl apply -f hpa.yaml\n\n    Verify the deployment:\n\nbash\n\nkubectl get pods\nkubectl get svc\nkubectl get hpa\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftks-devops%2Fk8s-deployment-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftks-devops%2Fk8s-deployment-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftks-devops%2Fk8s-deployment-project/lists"}