Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 5Name in the course: Helm, Kustomize, CRDs and operators

Install components with Helm and Kustomize

Real clusters run many components (ingress controllers, monitoring, cert-manager). Helm installs them as versioned charts with values. Kustomize changes plain YAML per environment without templates. Many components add their own object types with CRDs and run them with operators.

  • 4 Lessons
  • 3 Commands

$ run as a normal user# run as root (or with sudo)

Skills in this chapter

  • Install components with Helm and Kustomize; understand CRDs and operators

5.1

Install a chart with Helm

A chart is a package of templates; a release is an installed chart with your values.

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm search repo ingress-nginx
helm show values ingress-nginx/ingress-nginx > values.yaml
helm install ingress ingress-nginx/ingress-nginx -n ingress-nginx --create-namespace --set controller.replicaCount=2
helm list -A
helm status ingress -n ingress-nginx

Commands in this lesson

5.2

Upgrade and roll back a release

Every change is a new revision; roll back to any old one.

helm upgrade ingress ingress-nginx/ingress-nginx -n ingress-nginx -f values.yaml
helm history ingress -n ingress-nginx
helm rollback ingress 1 -n ingress-nginx
helm template ingress ingress-nginx/ingress-nginx -f values.yaml > rendered.yaml
helm uninstall ingress -n ingress-nginx
CommandDoes
helm install NAME CHARTInstall a new release
helm upgrade --installInstall or upgrade (good in pipelines)
-f values.yaml, --set k=vYour values
helm get values NAMEThe values in use
helm templateRender YAML without installing
helm rollback NAME REVGo back to a revision

Commands in this lesson

5.3

Change YAML with Kustomize

A kustomization.yaml lists resources and changes (name prefix, labels, image tags, patches). kubectl apply -k builds and applies it.

base/kustomization.yaml
resources:
  - deployment.yaml
  - service.yaml
overlays/prod/kustomization.yaml
resources:
  - ../../base
namespace: shop-prod
namePrefix: prod-
labels:
  - pairs: { env: prod }
images:
  - name: ghcr.io/s0sta/shop
    newTag: "1.4.0"
patches:
  - target: { kind: Deployment, name: web }
    patch: |-
      - op: replace
        path: /spec/replicas
        value: 4
kubectl kustomize overlays/prod
kubectl apply -k overlays/prod
kubectl diff -k overlays/prod

5.4

Understand CRDs and operators

A CustomResourceDefinition adds a new object type to the API (for example Certificate from cert-manager). An operator is a controller that watches those objects and does the work.

kubectl get crd
kubectl api-resources | grep cert-manager
kubectl explain certificate.spec
kubectl get certificates -A

Remember

Install the CRDs before objects of that type — otherwise kubectl apply says "no matches for kind".

All commands in this chapter