Skip to content
Visual explainer 4h to learn 5 steps

Helm, Kustomize, CRDs & operators

Install components with Helm or Kustomize and work with custom resources.

By Invicly Tech, , in Kubernetes Administrator (CKA). About 8 minutes to read.

Topic 11 of 33

In short

Helm packages applications as charts with templated manifests and configurable values. Kustomize customizes plain YAML with overlays and is built into kubectl. CRDs add new resource types, and operators are controllers that manage those custom resources automatically.

Explained simply

Real applications need many YAML files: Deployments, Services, ConfigMaps, RBAC rules. Copying and editing them by hand for every environment gets messy. Helm and Kustomize are two tools that package and customise those files so installs are repeatable.

Helm is like an app store with installers. A chart is a package with templates and a list of settings called values. You install it with your own values. Kustomize is more like tracing paper: you keep plain base YAML and lay small patches over it for dev or prod.

Custom Resource Definitions (CRDs) let you add your own object types, such as a Database or a Certificate. An operator is a program that watches those objects and does the real work, like creating Pods and backups. Many Helm charts install exactly this pair.

Press Play on a diagram to walk through it one step at a time.

CompareHelm vs Kustomize
Helm
  • Templated charts
  • values.yaml and --set overrides
  • Releases with history and rollback
  • Install from chart repositories
Kustomize
  • Template-free YAML
  • Base plus overlays
  • Built into kubectl apply -k
  • Patches, prefixes, image tags
CycleOperator reconcile loop
  1. 1
    Watch custom resource

    Operator watches objects of its CRD kind.

  2. 2
    Compare states

    Desired spec versus actual cluster resources.

  3. 3
    Act

    Create, update or delete Pods, Services and more.

  4. 4
    Update status

    Write results to the resource's status field.

  5. Back to step 1
MapA Kustomize layout with overlays
app/
  • base/
    • deployment.yaml
    • service.yaml
    • kustomization.yaml
  • overlays/dev/
    • kustomization.yaml (namespace: dev)
    • replicas-patch.yaml (1 replica)
  • overlays/prod/
    • kustomization.yaml (namespace: prod)
    • replicas-patch.yaml (5 replicas)
    • images: tag 2.1.0
FlowWhat helm install does
  1. 1
    Load chart

    Templates and default values

  2. 2
    Merge values

    Defaults, then -f files, then --set

  3. 3
    Render

    Templates become plain YAML

  4. 4
    Apply

    Objects sent to the API server

  5. 5
    Record

    Release stored as a Secret

In depth

Helm day-to-day

A typical flow is: helm repo add to register a chart repository, helm repo update to refresh its index, helm search repo to find a chart, and helm show values to see what you can configure. Then helm install NAME CHART -n NS --create-namespace -f my-values.yaml installs a release.

helm upgrade --install is handy because it installs if missing and upgrades if present. helm history and helm rollback NAME REVISION undo a bad change. helm template renders the YAML without installing, which is great for checking what a chart will create.

  • helm list -A shows releases in all namespaces
  • helm get values NAME shows the values you set
  • helm uninstall NAME -n NS removes a release

Where Helm keeps its memory

Helm 3 has no server component. It stores each release revision as a Secret in the release's namespace, named like sh.helm.release.v1.web.v3. That record holds the rendered manifests and values, which is how upgrade and rollback know what to change.

This also explains a common surprise: helm list without -n only shows releases in your current namespace. If a release seems missing, add -A.

FlowRelease history stored as Secrets
  1. Step 1
    helm install web

    Secret sh.helm.release.v1.web.v1

  2. Step 2
    helm upgrade web

    Revision 2, new Secret .v2

  3. Step 3
    helm rollback web 1

    Reads revision 1's manifests

  4. Step 4
    Revision 3

    Rollback is recorded as a new revision

Kustomize building blocks

A folder with a kustomization.yaml file is a kustomization. It lists resources (YAML files or other folders) and transformations: namespace sets the namespace on everything, namePrefix adds a prefix, labels adds labels, images changes image tags, and patches applies strategic merge or JSON patches.

configMapGenerator builds ConfigMaps from files or literals and adds a hash suffix to the name. When the content changes, the name changes, and Deployments that use it roll out automatically. kubectl kustomize DIR previews the output; kubectl apply -k DIR applies it.

FlowWhy configMapGenerator triggers a rollout
  1. Step 1
    Edit the source file
  2. Step 2
    New hash suffix

    Name changes, e.g. app-config-7f9k2m

  3. Step 3
    References updated

    Deployment now points at the new name

  4. Step 4
    Pod template changed

    Deployment rolls out new Pods

CRDs and validation

A CRD registers a new resource type with a group, version, kind and an OpenAPI schema. The schema validates objects and powers kubectl explain for the new kind. Once a CRD exists, kubectl get, describe and apply work on its objects like any built-in resource.

Deleting a CRD deletes every object of that type, so be careful. Use kubectl get crd to list them and kubectl api-resources --api-group=GROUP to see the kinds they add.

Learn it in 5 short steps

About 50m each. Track them with a timer in your plan.

  1. 1
    Install a chart with Helm~50m
  2. 2
    Override chart values~50m
  3. 3
    Apply overlays with Kustomize~50m
  4. 4
    Create and use a CRD~50m
  5. 5
    Explain the operator pattern~50m

Key points

  • helm install RELEASE CHART creates a release; helm upgrade changes it.
  • Override values with -f values.yaml or --set key=value.
  • kubectl apply -k DIR builds and applies a kustomization.
  • A CRD alone only stores data; a controller gives it behavior.

Key terms

Tap a card to flip it. 0/5 known

Examples

bash
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm install web bitnami/nginx -n web --create-namespace \
  --set replicaCount=2
helm list -n web
helm upgrade web bitnami/nginx -n web -f values.yaml
helm rollback web 1 -n web

kubectl kustomize overlays/prod   # preview
kubectl apply -k overlays/prod
kubectl get crd

Installing ingress-nginx with Helm and one override

Step 1: add and update the repository. Step 2: check the available values. Step 3: install into its own namespace with a NodePort Service, because a lab has no cloud load balancer. Step 4: confirm the release and its Pods.

bash
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm show values ingress-nginx/ingress-nginx | grep -A3 'type: LoadBalancer'
helm install ingress ingress-nginx/ingress-nginx -n ingress-nginx \
  --create-namespace --set controller.service.type=NodePort
helm list -n ingress-nginx
kubectl -n ingress-nginx get pods,svc

A prod overlay with Kustomize

Step 1: the base folder holds a plain Deployment named web. Step 2: the prod overlay points at the base, sets the namespace, raises replicas and pins the image tag. Step 3: preview with kubectl kustomize, then apply with -k.

yaml
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: prod
images:
- name: nginx
  newTag: "1.27"
patches:
- target: {kind: Deployment, name: web}
  patch: |-
    - {op: replace, path: /spec/replicas, value: 5}
# kubectl kustomize overlays/prod && kubectl apply -k overlays/prod

Quick reference

  • helm upgrade --install NAME CHART -n NS --create-namespace -f values.yaml
  • helm show values CHART > values.yaml to see every setting
  • helm rollback NAME REV; helm history NAME shows revisions
  • helm template NAME CHART renders YAML without installing
  • kubectl kustomize DIR previews; kubectl apply -k DIR applies
  • configMapGenerator adds a hash suffix so config changes roll Pods
  • k get crd; k explain KIND works when the CRD has a schema

Common mistakes

  • Forgetting -n on helm commands, so the release lands in default.
  • Deleting a CRD, which deletes all of its custom resources.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1helm list shows nothing, but you know a release exists. What is the likely reason?

Question 2

2In which order does Helm merge values?

Question 3

3Why does configMapGenerator add a hash to the ConfigMap name?

Question 4

4You apply a CRD named backups.example.com. What do you still need for backups to actually happen?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Install the bitnami/nginx chart as release web in namespace web with 2 replicas, then list the release.

  2. Exercise 2medium

    Upgrade release web to 3 replicas, then roll back to the previous revision and confirm the replica count.

  3. Exercise 3hard

    Create a CRD for kind Website (group demo.io, version v1, namespaced) with a required string field spec.url, then create one Website and list it.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Should I use Helm or Kustomize?
Use Helm to install third-party software that ships as a chart. Use Kustomize for your own plain YAML across environments. Many teams use both.
Is Kustomize a separate install?
No. It is built into kubectl through kubectl kustomize and kubectl apply -k. A standalone kustomize binary exists if you want a newer version.
What is the difference between a CRD and an operator?
A CRD adds a new object type to the API. An operator is a controller that watches those objects and performs actions to make reality match them.

Go deeper

ShareXLinkedInWhatsApp