Skip to content
Kubernetes tools · Chapter 14 of 20 Day 12: Helm and GitOps CLIs

Day 12: Helm and GitOps CLIs

Goal: Preview Helm upgrades with helm-diff, install plugins under Helm 4 with a verified signature, check charts before use, and operate the command lines of Argo CD and Flux in a quick run-through: create, compare, synchronize, detect drift, suspend · Duration: approx. 85 min · Prerequisite: Day 11

Briefing

  • helm upgrade changes the cluster without showing beforehand what changes. helm-diff is the plugin that makes up for exactly that: a diff between what is running and what the upgrade would create. It belongs in front of every upgrade.
  • Helm 4 checks plugins for a signature by default. If you type in the instructions from the Helm 3 era, you fail. That is not a bug but intentional.
  • Argo CD and Flux keep the cluster at the state of a Git repo. Both have a command line with which you get more done in everyday work than in any UI: create apps, see differences, trigger a sync, find drift, suspend an app.
  • Today is not about GitOps as a concept (there are separate courses for that), but about the hands-on moves. You install both tools minimally, use them and remove them again.
Tool Version
Helm v4.3.2 (on the VM since Day 0)
helm-diff v3.15.15
Argo CD (CLI and core installation) v3.6.2
Flux (CLI and two controllers) v2.10.1

Drill 1: helm-diff under Helm 4

The classic way from many tutorials:

helm plugin install https://github.com/databus23/helm-diff --version v3.15.15

Expected:

Error: plugin source does not support verification. Use --verify=false to skip verification

Helm 4 cannot verify a Git repo as a source. --verify=false would be the convenient way, but then you install code that runs with your cluster credentials without knowing who it comes from. The right way: the release archive with signature (.prov) and the maintainer’s public key.

curl -sL https://github.com/databus23.gpg | gpg --import
gpg --list-keys --with-fingerprint EA17A2A206AFF8CD | head -3

Expected:

gpg: Total number processed: 1
gpg:               imported: 1
pub   rsa4096 2026-06-15 [SC] [expires: 2028-06-14]
      C564 5EF4 7482 257A 1F80  6D2B EA17 A2A2 06AF F8CD
uid           [ unknown] Fabian Ruff (helm-diff release key) <[email protected]>

Compare the fingerprint with the one in the project’s release notes and README. Only then:

ARCH=$(dpkg --print-architecture)
helm plugin install https://github.com/databus23/helm-diff/releases/download/v3.15.15/diff-3.15.15-linux-${ARCH}.tgz
helm diff version

Expected:

Using Key With Fingerprint: C5645EF47482257A1F806D2BEA17A2A206AFF8CD
Plugin Hash Verified: sha256:504e99410611daa70702362e1b10dc74929df8a912cb3f6b5d21d1ee9d0cb7d9
Installed plugin: diff
3.15.15

Helm fetched the .prov file next to the archive itself, verified the signature against your keyring and compared the hash. With helm plugin verify <archive>, you check a downloaded archive even without installing it.

Observed: For helm-diff, helm plugin list shows mismatched provenance in the PROVENANCE column, although the installation verified the hash. The plugin still uses the older plugin format (APIVERSION legacy). Rely on the output of the installation and on helm plugin verify.

Save your progress? Sign up for free

Drill 2: Previewing an Upgrade

Headlamp from Day 6 runs with a custom value:

helm get values headlamp -n headlamp

Expected:

USER-SUPPLIED VALUES:
clusterRoleBinding:
  create: false

Now Headlamp is to get two replicas. What would an upgrade change?

helm diff upgrade headlamp headlamp/headlamp -n headlamp --version 0.46.0 --set replicaCount=2 | grep -E "^(\+|-|headlamp,)" | head -20

Expected (colors removed):

headlamp, headlamp, Deployment (apps) has changed:
-   replicas: 1
+   replicas: 2
headlamp, headlamp-admin, ClusterRoleBinding (rbac.authorization.k8s.io) has been added:
- 
+ # Source: headlamp/templates/clusterrolebinding.yaml
+ apiVersion: rbac.authorization.k8s.io/v1
+ kind: ClusterRoleBinding
+ metadata:
+   name: headlamp-admin
+   labels:
+     helm.sh/chart: headlamp-0.46.0
+     app.kubernetes.io/name: headlamp
+     app.kubernetes.io/instance: headlamp
+     app.kubernetes.io/version: "0.46.0"
+     app.kubernetes.io/managed-by: Helm
+ roleRef:
+   apiGroup: rbac.authorization.k8s.io
+   kind: ClusterRole
+   name: cluster-admin

This is the reason for helm-diff. If you specify only --set replicaCount=2 with helm upgrade, you lose all earlier --set values. The admin binding from Day 6 would silently come back. With --reuse-values, the old values are kept. -C 2 shortens the context to two lines:

helm diff upgrade headlamp headlamp/headlamp -n headlamp --version 0.46.0 --reuse-values --set replicaCount=2 -C 2

Expected:

headlamp, headlamp, Deployment (apps) has changed:
...
      app.kubernetes.io/managed-by: Helm
  spec:
-   replicas: 1
+   replicas: 2
    selector:
      matchLabels:
...

Only the replicas remain. For pipelines, there is --detailed-exitcode:

helm diff upgrade headlamp headlamp/headlamp -n headlamp --version 0.46.0 --reuse-values --set replicaCount=2 --detailed-exitcode >/dev/null 2>&1; echo "exit $?"
helm diff upgrade headlamp headlamp/headlamp -n headlamp --version 0.46.0 --reuse-values --detailed-exitcode >/dev/null 2>&1; echo "exit $?"

Expected:

exit 2
exit 0

2 means “there are changes”, 0 means “nothing to do”. Now the upgrade, and then the history:

helm upgrade headlamp headlamp/headlamp -n headlamp --version 0.46.0 --reuse-values --set replicaCount=2 | grep -E "STATUS|REVISION"
helm history headlamp -n headlamp
helm diff revision headlamp 2 3 -n headlamp -C 1

Expected (times will differ):

STATUS: deployed
REVISION: 3
REVISION    UPDATED                     STATUS      CHART           APP VERSION DESCRIPTION
1           Tue Nov 24 13:01:45 2026    superseded  headlamp-0.46.0 0.46.0      Install complete
2           Tue Nov 24 13:07:14 2026    superseded  headlamp-0.46.0 0.46.0      Upgrade complete
3           Tue Nov 24 13:49:42 2026    deployed    headlamp-0.46.0 0.46.0      Upgrade complete
headlamp, headlamp, Deployment (apps) has changed:
...
  spec:
-   replicas: 1
+   replicas: 2
    selector:
...

helm diff revision compares two stored states. Back to revision 2:

helm rollback headlamp 2 -n headlamp
helm history headlamp -n headlamp --max 2
kubectl get clusterrolebinding headlamp-admin

Expected:

Rollback was a success! Happy Helming!
REVISION    UPDATED                     STATUS      CHART           APP VERSION DESCRIPTION
3           Tue Nov 24 13:49:42 2026    superseded  headlamp-0.46.0 0.46.0      Upgrade complete
4           Tue Nov 24 13:49:46 2026    deployed    headlamp-0.46.0 0.46.0      Rollback to 2
Error from server (NotFound): clusterrolebindings.rbac.authorization.k8s.io "headlamp-admin" not found

A rollback is a new revision (4), not a deletion of 3. The admin binding stays gone.

Save your progress? Sign up for free

Drill 3: Checking Charts Before They Run

The tools from Day 10 read from stdin. helm template renders a chart without touching the cluster:

helm template headlamp headlamp/headlamp --version 0.46.0 --set clusterRoleBinding.create=false | kubeconform -strict -summary -kubernetes-version 1.37.0
helm template headlamp headlamp/headlamp --version 0.46.0 | kube-linter lint - 2>&1 | grep -o "(check: [a-z-]*" | sort | uniq -c

Expected:

Summary: 4 resources found parsing stdin - Valid: 4, Invalid: 0, Errors: 0, Skipped: 0
      1 (check: no-read-only-root-fs
      1 (check: unset-cpu-requirements
      1 (check: unset-memory-requirements

What stands out is what is missing: with default values, the chart binds cluster-admin, and kube-linter says nothing. The matching check is not active by default:

helm template headlamp headlamp/headlamp --version 0.46.0 | kube-linter lint --include cluster-admin-role-binding - 2>&1 | grep -E "cluster-admin|Error" | cut -c1-160

Expected:

<standard input>: (object: <no namespace>/headlamp-admin rbac.authorization.k8s.io/v1, Kind=ClusterRoleBinding) cluster-admin role is bound to [{"kind":"ServiceAccount","name":"headlamp","namespace":"default"}] (check: c
Error: found 4 lint errors

For third-party charts, --include for the RBAC checks is worth it. (namespace: default appears there because helm template renders without -n.)

Save your progress? Sign up for free

Drill 4: Argo CD in a Quick Run-Through

The core installation of Argo CD brings only the controllers, without the API server and web UI. The CLI then talks directly to the Kubernetes API, with your kubectl permissions.

ARCH=$(dpkg --print-architecture)
curl -sLo /tmp/argocd https://github.com/argoproj/argo-cd/releases/download/v3.6.2/argocd-linux-${ARCH}
sudo install /tmp/argocd /usr/local/bin/argocd
argocd version --client --short
kubectl create namespace argocd
kubectl apply -n argocd --server-side -f https://raw.githubusercontent.com/argoproj/argo-cd/v3.6.2/manifests/core-install.yaml
kubectl -n argocd rollout status statefulset/argocd-application-controller --timeout=240s
kubectl -n argocd rollout status deploy/argocd-repo-server --timeout=120s

Expected (excerpt):

argocd: v3.6.2+8e8268e
namespace/argocd created
…
partitioned roll out complete: 1 new pods have been updated...
deployment "argocd-repo-server" successfully rolled out

--server-side is necessary because some Argo CD CRDs are too large for the annotation of classic kubectl apply (Day 2). In core mode, the CLI expects the current namespace to be argocd:

kubectl config set-context --current --namespace=argocd
argocd login --core
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook \
  --dest-server https://kubernetes.default.svc --dest-namespace guestbook --sync-option CreateNamespace=true
argocd app list

Expected:

Context 'kubernetes' updated
application 'guestbook' created
NAME              CLUSTER                         NAMESPACE  PROJECT  STATUS     HEALTH   SYNCPOLICY  CONDITIONS  REPO                                                 PATH       TARGET
argocd/guestbook  https://kubernetes.default.svc  guestbook  default  OutOfSync  Missing  Manual      <none>      https://github.com/argoproj/argocd-example-apps.git  guestbook

OutOfSync and Missing: the app is defined, but none of it is running. What would a sync create?

argocd app diff guestbook | head -15; echo "exit ${PIPESTATUS[0]}"

Expected (shortened):

===== /Service guestbook/guestbook-ui ======
0a1,13
> apiVersion: v1
> kind: Service
> metadata:
>   annotations:
>     argocd.argoproj.io/tracking-id: guestbook:/Service:guestbook/guestbook-ui
>   name: guestbook-ui
>   namespace: guestbook
…
exit 1

As with helm-diff: exit 1 means “there are differences”. Now synchronize:

argocd app sync guestbook | tail -4
argocd app wait guestbook --health --timeout 180 | tail -3

Expected:

GROUP  KIND        NAMESPACE  NAME          STATUS   HEALTH       HOOK  MESSAGE
       Namespace              guestbook     Running  Synced             namespace/guestbook created
       Service     guestbook  guestbook-ui  Synced   Healthy            service/guestbook-ui created
apps   Deployment  guestbook  guestbook-ui  Synced   Progressing        deployment.apps/guestbook-ui created
       Namespace              guestbook     Running  Synced         namespace/guestbook created
       Service     guestbook  guestbook-ui  Synced   Healthy        service/guestbook-ui created
apps   Deployment  guestbook  guestbook-ui  Synced   Healthy        deployment.apps/guestbook-ui created

Now the typical disruption: someone scales by hand.

kubectl -n guestbook scale deploy guestbook-ui --replicas=3
argocd app get guestbook | grep -E "Sync Status|^apps"
argocd app diff guestbook

Expected:

deployment.apps/guestbook-ui scaled
Sync Status:        OutOfSync from  (8088f4c)
apps   Deployment  guestbook  guestbook-ui  OutOfSync  Progressing        deployment.apps/guestbook-ui created

===== apps/Deployment guestbook/guestbook-ui ======
107c107
<   replicas: 3
---
>   replicas: 1

Argo CD notices the drift but does not correct it: the app is set to Manual. With self-heal, it corrects itself:

argocd app set guestbook --sync-policy automated --self-heal
sleep 15
kubectl -n guestbook get deploy guestbook-ui

Expected:

NAME           READY   UP-TO-DATE   AVAILABLE   AGE
guestbook-ui   1/1     1            1           102s

Back to one replica, without anyone doing anything. The CLI may report a line Error received from server tcpm: … use of closed network connection; that is the internal port forward of core mode shutting down, not an error of the action.

Clean up, in the right order. An Argo CD app has a finalizer: it deletes its resources first and then disappears itself. For that, the controller must still be running.

argocd app delete guestbook --yes
kubectl -n argocd wait --for=delete application/guestbook --timeout=120s
kubectl config set-context --current --namespace=default
kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v3.6.2/manifests/core-install.yaml
kubectl delete ns argocd guestbook

Expected (shortened):

{"level":"info","msg":"Warning: metadata.finalizers: \"resources-finalizer.argocd.argoproj.io\": prefer a domain-qualified finalizer name including a path (/) to avoid accidental conflicts with other finalizer writers",…}
application 'guestbook' deleted
application.argoproj.io/guestbook condition met
Context "kind-werkzeuge" modified.
…
namespace "argocd" deleted
namespace "guestbook" deleted

Argo CD created the namespace guestbook via CreateNamespace=true, but does not manage it as part of the app; it stays in place when the app is deleted.

Happened during testing: argocd app delete returns immediately. If you uninstall Argo CD right afterwards, you delete the controller before it has processed the finalizer. The app then hangs, and with it the namespaces argocd and guestbook in Terminating. This can only be rescued by hand: kubectl -n argocd patch application guestbook --type=merge -p '{"metadata":{"finalizers":null}}'. Hence the wait in between.

Save your progress? Sign up for free

Drill 5: Flux in a Quick Run-Through

curl -sL https://github.com/fluxcd/flux2/releases/download/v2.10.1/flux_2.10.1_linux_${ARCH}.tar.gz | tar xz -C /tmp flux
sudo install /tmp/flux /usr/local/bin/
flux version --client
flux check --pre

Expected:

flux: v2.10.1
► checking prerequisites
✔ Kubernetes 1.37.0 >=1.35.0-0
✔ prerequisites checks passed

For Git and Kustomize, two of the controllers are enough:

flux install --components=source-controller,kustomize-controller
flux create source git podinfo --url=https://github.com/stefanprodan/podinfo --tag=6.9.2 --interval=10m
flux create kustomization podinfo --source=GitRepository/podinfo --path=./kustomize --prune=true \
  --target-namespace=podinfo --interval=10m --wait=false

Expected (excerpt):

✔ install finished
✔ GitRepository source reconciliation completed
✔ fetched revision: 6.9.2@sha1:e86405a8674ecab990d0a389824c7ebbd82973b5

…and then flux create kustomization waits forever. Abort with Ctrl-C and ask:

flux get kustomizations -A

Expected:

NAMESPACE   NAME    REVISION    SUSPENDED   READY   MESSAGE
flux-system podinfo             False       False   Service/podinfo/podinfo not found: namespaces "podinfo" not found

--target-namespace sets the namespace in every object but does not create it. Unlike Argo CD with CreateNamespace=true, there is no switch for this here; the namespace belongs in the repo or is created beforehand.

kubectl create ns podinfo
flux reconcile kustomization podinfo
flux get all -A
flux tree kustomization podinfo

Expected:

namespace/podinfo created
◎ waiting for Kustomization reconciliation
✔ applied revision 6.9.2@sha1:e86405a8674ecab990d0a389824c7ebbd82973b5
NAMESPACE   NAME                    REVISION            SUSPENDED   READY   MESSAGE
flux-system gitrepository/podinfo   6.9.2@sha1:e86405a8 False       True    stored artifact for revision '6.9.2@sha1:e86405a8'

NAMESPACE   NAME                    REVISION            SUSPENDED   READY   MESSAGE
flux-system kustomization/podinfo   6.9.2@sha1:e86405a8 False       True    Applied revision: 6.9.2@sha1:e86405a8
Kustomization/flux-system/podinfo
├── Service/podinfo/podinfo
├── Deployment/podinfo/podinfo
└── HorizontalPodAutoscaler/podinfo/podinfo

flux reconcile triggers a reconciliation immediately instead of waiting for the interval. flux tree shows what a Kustomization manages, like kubectl tree from Day 4 does for owners.

See beforehand what a change does. Get the state from Git and change something locally:

mkdir -p ~/werkzeuge/tag12 && cd ~/werkzeuge/tag12
git clone -q --depth 1 --branch 6.9.2 https://github.com/stefanprodan/podinfo
sed -i "s/minReplicas: 2/minReplicas: 3/" podinfo/kustomize/hpa.yaml
flux diff kustomization podinfo --path ./podinfo/kustomize; echo "exit $?"

Expected:

► HorizontalPodAutoscaler/podinfo/podinfo drifted

metadata.generation
± value change
- 1
+ 2

spec.minReplicas
± value change
- 2
+ 3

⚠️ identified at least one change, exiting with non-zero exit code
exit 1

This is the counterpart to helm diff and argocd app diff, computed against the cluster and with Server-Side Apply. In a pipeline, this runs on every pull request.

Drift and suspending. Change something by hand and let Flux reconcile; then suspend the Kustomization and repeat it:

kubectl -n podinfo patch hpa podinfo -p '{"spec":{"maxReplicas":10}}'
flux reconcile kustomization podinfo
kubectl -n podinfo get hpa podinfo -o jsonpath='{.spec.maxReplicas}{"\n"}'
flux suspend kustomization podinfo
kubectl -n podinfo patch hpa podinfo -p '{"spec":{"maxReplicas":10}}'
flux reconcile kustomization podinfo
kubectl -n podinfo get hpa podinfo -o jsonpath='{.spec.maxReplicas}{"\n"}'
flux resume kustomization podinfo
kubectl -n podinfo get hpa podinfo -o jsonpath='{.spec.maxReplicas}{"\n"}'

Expected (Flux messages shortened):

horizontalpodautoscaler.autoscaling/podinfo patched
✔ applied revision 6.9.2@sha1:e86405a8674ecab990d0a389824c7ebbd82973b5
4
✔ kustomization suspended
horizontalpodautoscaler.autoscaling/podinfo patched
✗ resource is suspended
10
✔ applied revision 6.9.2@sha1:e86405a8674ecab990d0a389824c7ebbd82973b5
4

The sequence you need in an incident: suspend, intervene by hand, put the cause into the repo, resume. Without suspend, Flux overwrites your intervention at the next reconciliation. flux resume reconciles immediately, which is why it says 4 again afterwards.

You extract what is in the cluster as a Flux object as YAML, for example to put it into the repo:

flux export source git podinfo

Expected:

---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: podinfo
  namespace: flux-system
spec:
  interval: 10m0s
  ref:
    tag: 6.9.2
  timeout: 1m0s
  url: https://github.com/stefanprodan/podinfo

Clean up:

flux delete kustomization podinfo --silent
flux delete source git podinfo --silent
flux uninstall --silent
kubectl delete ns podinfo

Save your progress? Sign up for free

Exercise: Three Diffs

Match which command answers which question, and what exit code 0 means:

  1. helm diff upgrade … --detailed-exitcode
  2. argocd app diff <app>
  3. flux diff kustomization <name> --path <folder>
  1. What would change if this local folder were merged?
  2. Does the cluster deviate from the state in Git?
  3. What does this chart upgrade with these values change?

Solution

1 → c, 2 → b, 3 → a. For all three, exit 0 means “no differences”. With changes, helm-diff with --detailed-exitcode exits with 2, argocd app diff and flux diff with 1. With --local <folder>, argocd app diff can also answer question a.

Save your progress? Sign up for free

Challenge

Write down the order of commands for this maintenance window, without running them: in a Flux-managed namespace, a Deployment has to go to zero replicas for one hour because of database maintenance. Afterwards, everything should be as in Git again. What happens if you forget suspend?

Solution

flux suspend kustomization <name>
kubectl -n <ns> scale deploy <app> --replicas=0
# … maintenance …
flux resume kustomization <name>
flux get kustomizations

Without suspend, Flux resets the replicas at the next reconciliation, depending on the interval after minutes, in the middle of the maintenance. resume restores the state from Git immediately; a separate scale back is not necessary. With Argo CD, the way is: switch off auto-sync (argocd app set <app> --sync-policy none), then switch it on again afterwards. If there is a HorizontalPodAutoscaler in Git, it belongs in the consideration too: it does not respect replicas: 0.

Save your progress? Sign up for free

Checkpoint

helm diff version
helm history headlamp -n headlamp --max 1 -o json | jq -r '.[0].description'
kubectl get ns argocd guestbook flux-system podinfo --ignore-not-found --no-headers | wc -l
argocd version --client --short; flux version --client

Expected:

3.15.15
Rollback to 2
0
argocd: v3.6.2+8e8268e
flux: v2.10.1

The CLIs stay, the controllers are gone.

Interview Note

  • How do you avoid surprises with helm upgrade? helm diff upgrade beforehand, --reuse-values deliberately, or better all values in a file (-f values.yaml) in the repo.
  • What do you do if you have to intervene by hand in a GitOps cluster? Suspend reconciliation (flux suspend, auto-sync off), intervene, put the change into the repo, reactivate. Otherwise you fight against the controller.
  • Why is --verify=false for Helm 4 plugins not a good idea? Plugins run with your credentials. Checking the signature and key takes a minute.

Enterprise Note

  • In pipelines, each pull request should get a diff against the real cluster in a comment: helm diff, flux diff or argocd app diff --local. Reviewers then see what happens, not just what changes in YAML.
  • The core installation of Argo CD fits teams that do not need a UI; permissions then come solely from Kubernetes RBAC. With the API server and SSO, Argo CD becomes a platform for many teams.
  • The plugin authors’ public keys belong in a shared keyring that is distributed with the base image or the runner. That way, everyone verifies against the same trusted keys.

Contents

More