Helm
Helm is the package manager for Kubernetes that bundles manifests into versioned, parameterised charts so one chart can deploy to many environments with different values.
Understanding Helm in CI/CD
What Is Helm and Why Use It in a Pipeline
Helm packages the Deployment, Service, Ingress, ConfigMap, and other manifests of an application into one chart, and fills in values at install time. A release is one installed instance of a chart, and Helm records its history so you can roll back. In CI/CD the same chart deploys to dev, staging, and production with different values files.
Chart Layout and Values Layering
Later -f files and --set flags override earlier ones, so defaults live in values.yaml and environment differences live in small override files.
Deploying from a Pipeline
steps: - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::123456789:role/github-deploy aws-region: ap-south-1 - name: Connect to cluster run: aws eks update-kubeconfig --name mumbai-prod-cluster --region ap-south-1 - name: Deploy with Helm run: | helm upgrade --install payment-api ./charts/payment-api \ --namespace payment-api-production \ --values ./charts/payment-api/values-production.yaml \ --set image.repository=${{ env.ECR_REGISTRY }}/payment-api \ --set image.tag=${{ github.sha }} \ --atomic \ --timeout 5mThe --atomic flag waits for readiness and rolls back automatically if the upgrade fails or times out.
Default values.yaml
replicaCount: 2 image: repository: payment-api tag: "" # set by CI to the Git SHA pullPolicy: IfNotPresent resources: requests: cpu: 250m memory: 256Mi limits: cpu: 500m memory: 512Mi autoscaling: enabled: false minReplicas: 2 maxReplicas: 20 targetCPUUtilizationPercentage: 70Practical Commands
# Install or upgrade (idempotent)helm upgrade --install payment-api ./charts/payment-api -n payments --create-namespace # Preview rendered output and a diff-like dry runhelm template payment-api ./charts/payment-api -f values-production.yamlhelm upgrade --install payment-api ./charts/payment-api --dry-run --debug # Inspect and roll backhelm list -Ahelm history payment-api -n paymentshelm rollback payment-api 2 -n paymentsTroubleshooting
| Symptom | Check | What to Look For |
|---|---|---|
| Release stuck pending-upgrade | helm history |
A failed upgrade left a lock |
| Template error | helm template |
Syntax error in a template |
| Values not applied | helm get values |
Wrong file order or key name |
| Pods will not start | kubectl describe pod |
Image pull or resource issue |
TipRun
helm lintandhelm templatein the pull request pipeline so broken charts fail before they reach a cluster.
Remember
helm upgrade --installis the idempotent command. It installs on the first run and upgrades afterwards, so the pipeline never needs two code paths.
SecurityDo not commit secrets in values files. Inject them with External Secrets Operator, Sealed Secrets, or Vault, and keep Git values non-sensitive.
Common MistakeUsing
helm installin CI. It fails on the second run because the release already exists. Usehelm upgrade --install.
Frequently Asked Questions
Why use Helm instead of plain Kubernetes manifests in a pipeline?
Plain manifests need a duplicated YAML tree per environment. Helm uses one chart plus values files, and it keeps release history so helm rollback can revert a bad deploy without rebuilding old manifests.
What does the --atomic flag do?
It makes Helm wait for resources to become ready and automatically roll back the release if the upgrade fails or times out. Without it a failed upgrade can leave a broken release marked as deployed or pending.
How do I pass the image tag from CI to Helm?
Use --set image.tag with the commit SHA, or a digest value if the chart supports it. Avoid hardcoding tags in templates, which breaks reproducible pipeline-driven deploys.