Ravindra BagaleCourses & study guides मराठी

Chapter 85: Helm for Kubernetes

DevOps

85.5 Dry-run and helm template — see YAML before apply

Story. Before touching prod, a Deloitte-style team in Mumbai always ran helm template in the pull request. Reviewers read plain YAML. A bad indent in a Service never reached the cluster because the pipeline failed on helm lint first.

helm lint helm template dry-run --debug Review in PR Then upgrade
lint checks the chart; template renders YAML; dry-run --debug shows what install would send.

Why

Rendering locally catches typos without creating a release.

What

  • helm lint — Checks chart structure and common mistakes.
  • helm template — Prints rendered YAML to stdout. No cluster needed.
  • --dry-run — Talks through the release without persisting (with --debug prints manifests).
  • --set / -f — Override values the same way as a real install.

Example 1: Lint

helm lint hello-web

Output

==> Linting hello-web
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, 0 chart(s) failed

What it shows: Structure is OK. Icon warning is optional.

Example 2: Template with overrides

helm template hello hello-web --set replicaCount=5 -n lab | head -n 40

Output

---
# Source: hello-web/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello
...
spec:
  replicas: 5

What it shows: replicaCount=5 appears in the rendered Deployment.

Example 3: Dry-run against a live cluster

helm upgrade --install hello hello-web -n lab --dry-run --debug 2>&1 | tail -n 20

What it shows: Computed manifests and notes without changing cluster state (still validates against the API in many cases).

Ravindra Bagale's Tip

Put helm lint and helm template in the pull-request job before any cluster credentials are used.

Quick quiz

Q1. Which command needs no cluster?

helm template (and helm lint).

Q2. How do you override one value on the CLI?

--set key=value

Q3. Why lint in CI?

It catches chart mistakes before deploy.

Did you understand? Let us try it once more.