DEV Community

Anjali Gurjar
Anjali Gurjar

Posted on

CI/CD pipeline

CI/CD for Kubernetes (Automate Builds and Deployments)
GitHub Actions / Jenkins: Automate Docker builds and K8s deployments.
Example GitHub Action:
yaml
Copy code
name: CI/CD Pipeline
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker Image
run: docker build -t username/myapp:${{ github.sha }} .
- name: Push to Docker Hub
run: docker push username/myapp:${{ github.sha }}
- name: Deploy to K8s
run: |
kubectl set image deployment/myapp-deployment myapp=username/myapp:${{ github.sha }}

Top comments (0)