{"id":14984740,"url":"https://github.com/alilotfi23/jenkins-k8s","last_synced_at":"2026-02-14T06:30:58.677Z","repository":{"id":195496847,"uuid":"693026748","full_name":"alilotfi23/jenkins-K8s","owner":"alilotfi23","description":"Deployment on Kubernetes Cluster using Jenkins CI/CD Project","archived":false,"fork":false,"pushed_at":"2024-12-14T09:42:28.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T18:52:26.026Z","etag":null,"topics":["cd","ci","cicd","jenkins","jenkins-pipeline","kubernetes","kubernetes-cluster","kubernetes-deployment"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/alilotfi23.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":"2023-09-18T07:44:29.000Z","updated_at":"2025-03-17T09:34:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4cefaf3-4258-4a1b-95f0-ed7671239b28","html_url":"https://github.com/alilotfi23/jenkins-K8s","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"442384a52dce9fc15b387b049b41115ce489ed8d"},"previous_names":["alilotfi23/jenkins-k8s"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2Fjenkins-K8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2Fjenkins-K8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2Fjenkins-K8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2Fjenkins-K8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alilotfi23","download_url":"https://codeload.github.com/alilotfi23/jenkins-K8s/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248299024,"owners_count":21080449,"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":["cd","ci","cicd","jenkins","jenkins-pipeline","kubernetes","kubernetes-cluster","kubernetes-deployment"],"created_at":"2024-09-24T14:09:35.744Z","updated_at":"2026-02-14T06:30:58.633Z","avatar_url":"https://github.com/alilotfi23.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins-K8s Deployment\n\n### Overview\n\nThis project demonstrates deploying applications on a Kubernetes cluster using Jenkins for Continuous Integration and Continuous Deployment (CI/CD).\n\n### BluePrint\n\nThe following diagram provides a high-level overview of the CI/CD pipeline:\n\n![deploy](https://github.com/alilotfi23/jenkins-K8s/assets/91953142/86eaafd7-832f-4fae-81cd-e32f58ac1e48)\n\n1. **Source Code Push**: A developer pushes the source code to a Git repository.\n2. **Webhook Trigger**: The push event triggers a webhook to Jenkins.\n3. **Build Image**: Jenkins pulls the source code and builds a Docker image.\n4. **Push to Docker Hub**: The built Docker image is pushed to Docker Hub.\n5. **Deploy on Kubernetes**: The Docker image is deployed to a K8s cluster.\n\n### Prerequisites\n\nEnsure you have the following installed and configured:\n\n- Jenkins\n- Docker\n- Kubernetes Cluster\n- Git\n- Docker Hub Account\n\n### Setup Instructions\n\n#### 1. Jenkins Setup\n\n- Install Jenkins on your server.\n- Install the necessary plugins: Git, Docker, and Kubernetes.\n\n#### 2. Git Repository\n\n- Create a repository on GitHub or any Git service.\n- Add your project files to the repository.\n\n#### 3. Webhook Configuration\n\n- In your Git repository, configure a webhook to trigger Jenkins builds on code push events.\n\n#### 4. Jenkins Job Configuration\n\n- **Source Code Management**: Configure Jenkins to pull the source code from your Git repository.\n- **Build Triggers**: Set up the webhook to trigger the build process.\n- **Build Steps**:\n  - Use a Jenkins pipeline to build the Docker image.\n  - Push the Docker image to Docker Hub.\n- **Post-build Actions**: Deploy the Docker image to the Kubernetes cluster.\n\n#### 5. Docker Hub Configuration\n\n- Create a repository on Docker Hub to store your Docker images.\n\n#### 6. Kubernetes Deployment\n\n- Write Kubernetes deployment YAML files to deploy the Docker image from Docker Hub.\n- Ensure your Kubernetes cluster is configured to pull images from Docker Hub.\n\n### Jenkins Pipeline Script\n\nsample Jenkins pipeline script:\n\n```groovy\npipeline {\n    agent any\n\n    stages {\n        stage('Clone Repository') {\n            steps {\n                git 'https://github.com/your-repo.git'\n            }\n        }\n        stage('Build Docker Image') {\n            steps {\n                script {\n                    docker.build(\"your-dockerhub-username/your-image-name:latest\")\n                }\n            }\n        }\n        stage('Push to Docker Hub') {\n            steps {\n                script {\n                    docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-credentials-id') {\n                        docker.image(\"your-dockerhub-username/your-image-name:latest\").push()\n                    }\n                }\n            }\n        }\n        stage('Deploy to Kubernetes') {\n            steps {\n                kubernetesDeploy configs: 'k8s/deployment.yaml', kubeConfig: [path: 'path/to/kubeconfig']\n            }\n        }\n    }\n}\n```\n\n### Kubernetes Deployment YAML\n\nCreate a `deployment.yaml` file for your Kubernetes deployment:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: your-app\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: your-app\n  template:\n    metadata:\n      labels:\n        app: your-app\n    spec:\n      containers:\n      - name: your-app\n        image: your-dockerhub-username/your-image-name:latest\n        ports:\n        - containerPort: 80\n```\n\n### Conclusion\n\nBy following the above steps, you can set up a Jenkins pipeline to automate the deployment of your applications on a Kubernetes cluster. This ensures a smooth CI/CD process, enabling rapid development and deployment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falilotfi23%2Fjenkins-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falilotfi23%2Fjenkins-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falilotfi23%2Fjenkins-k8s/lists"}