# Helm, Kustomize, and CRDs/Operators

> New in the 2025 exam revision: managing deployment configuration with Helm and Kustomize, and how CRDs and Operators extend Kubernetes

- URL: https://lcxlab.com/en/post/cka-helm-kustomize-crd
- Author: Miles Hsu
- Published: 2026-11-11
- Category: DevOps
- Series: Certified Kubernetes Administrator (CKA) #10
- Tags: Helm, Kustomize, CKA, Kubernetes
- License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/deed.en)

---

![helm_and_kustomize](https://lcxlab.com/images/posts/cka-helm-kustomize-crd/helm_and_kustomize.webp)

After the CKA revision in February 2025, Cluster Architecture, Installation & Configuration gained a few items that were never there before: installing cluster components with Helm and Kustomize, understanding CRDs, and installing and configuring Operators. These three topics are really different sides of the same thing: the first two answer "how do I manage too much YAML across too many environments", and the last one answers "what do I do when the built-in Kubernetes resources aren't enough". As before, this post practices on the three-node cluster built in [Building a kubeadm Cluster (Part 2)](https://lcxlab.com/en/post/cka-kubeadm-cluster).

---

## Helm

### What Helm is: Charts, Releases, and Repositories

Helm is often called "the package manager for Kubernetes". Think of it as apt on Debian-based systems or pacman on Arch-based ones.

It does a few core things:

- Package management (Charts): it bundles the Deployment, Service, ConfigMap, RBAC and other YAML an application needs into one Chart, so a single command installs or removes the whole set of resources.
- Versioning and rollback: every install and upgrade is recorded as a revision, so when something breaks you can go straight back to an earlier version.
- Templating: the YAML in a Chart is Go templates. The parts that vary (replica count, image tag, Service type) are pulled out into values, and different values are passed in at install time.

First, let's map the three terms:

| Helm | apt analogy | Description |
| --- | --- | --- |
| Chart | Package (.deb) | A set of templates plus a default `values.yaml` |
| Repository | Package source (sources.list) | Where Charts are stored; an HTTP server or an OCI registry |
| Release | Installed package | An instance of a Chart installed in the cluster; the same Chart can be installed many times, each under its own Release name |

A Chart's directory structure looks like this:

```text
mychart/
├── Chart.yaml        # Chart name, version, appVersion
├── values.yaml       # Default values
├── charts/           # Dependent sub charts
└── templates/        # Go templates; rendered, they become ordinary Kubernetes YAML
    ├── deployment.yaml
    ├── service.yaml
    └── _helpers.tpl
```

>[!NOTE] No Tiller since Helm 3
>Helm 2 needed a component called Tiller running in the cluster. Helm 3 removed it: `helm` talks to kube-apiserver directly with your kubeconfig, so its permissions are whatever your current kubeconfig has. Release records are stored as Secrets in the release's namespace, named `sh.helm.release.v1.<release>.v<revision>`.

`helm` is already installed in the exam environment. To practice on your own, install it on the control plane with the official script:

```bash
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4 | bash
helm version
```

The commands in this post are the same in Helm 3 and Helm 4.

### Adding a Chart Repository and searching for Charts

The example here is [podinfo](https://github.com/stefanprodan/podinfo), a tiny Go web service that's often used to demo deployment tools.

![174656](https://lcxlab.com/images/posts/cka-helm-kustomize-crd/174656.webp)

```bash
# Add the repo and refresh the index (like apt update: run it after adding a repo or to get the latest versions)
helm repo add podinfo https://stefanprodan.github.io/podinfo
helm repo update

# List the repos you've added
helm repo list

# Search the repos you've added
helm search repo podinfo

# List all versions
helm search repo podinfo --versions
```

`helm search repo` only searches repos added locally; `helm search hub <keyword>` searches Artifact Hub instead. The exam environment usually can't reach the internet, so stick to `search repo`.

Before installing, you can look at the Chart's information and the values it offers:

```bash
helm show chart podinfo/podinfo      # Chart.yaml
helm show values podinfo/podinfo     # The default values.yaml
helm show values podinfo/podinfo > podinfo-values.yaml
```

Some Charts aren't in a traditional repo but in an OCI registry. Those don't need `repo add`; use a URL starting with `oci://` directly:

```bash
helm show values oci://ghcr.io/stefanprodan/charts/podinfo
```

### Installing a Chart and overriding values

```bash
helm install <release name> <chart> [flags]
```

The simplest install:

```bash
helm install web podinfo/podinfo -n demo --create-namespace
```

- `web` is the Release name. Resources created by the Chart usually include it in their names; the Deployment, for example, is called `web-podinfo`.
- `-n demo` sets the namespace, and `--create-namespace` lets Helm create it if it doesn't exist. Without `-n`, the release goes into your kubeconfig's current namespace, which makes it easy to install into the wrong place during the exam.

There are two ways to override values:

```bash
# 1. --set: good for changing one or two values; join nested keys with .
helm install web podinfo/podinfo -n demo --create-namespace \
  --set replicaCount=2 \
  --set ui.message="hello from helm"

# 2. -f / --values: override from a file; good for changing many values
cat <<EOF > my-values.yaml
replicaCount: 2
ui:
  message: "hello from helm"
  color: "#2e7d32"
service:
  type: NodePort
EOF

helm install web podinfo/podinfo -n demo --create-namespace -f my-values.yaml
```

From lowest to highest precedence: the Chart's `values.yaml` → files given with `-f` (with several `-f`, later ones win) → `--set`.

You can also pin a Chart version with `--version` (find version numbers with `helm search repo podinfo --versions`); without it, the latest version is installed:

```bash
helm install web podinfo/podinfo -n demo --version <chart version>
```

Check it after installing:

```bash
helm list -n demo            # List Releases; -A for all namespaces
helm status web -n demo      # Release status and the Chart's usage notes (NOTES)
helm get values web -n demo  # Values the user specified for this install
helm get values web -n demo --all   # The full values merged with the defaults
helm get manifest web -n demo       # The YAML actually applied to the cluster
kubectl get all -n demo
```

>[!TIP] 💡 When a task asks you to find a Release's settings
>`helm get values` only lists what was overridden at install time. If a task asks "what is the current replica count setting" and it was never overridden, you need `--all` to see the default.

### Upgrading, rolling back, and viewing Release history

Changing settings and switching Chart versions are both done with `helm upgrade`:

```bash
helm upgrade web podinfo/podinfo -n demo --set replicaCount=3
```

>[!WARNING] ⚠️ upgrade doesn't keep earlier --set values by default
>`helm upgrade` re-renders with the Chart's defaults plus the values given this time; values set with `--set` or `-f` last time are dropped. After running the line above, `ui.message` goes back to its default. To keep them:
>- Add `--reuse-values`: reuse the last values, then apply this time's overrides.
>- Or pass the same `-f my-values.yaml` every time, which is the recommended approach.

`helm upgrade --install` installs the Release if it doesn't exist and upgrades it if it does, which is very common in scripts and CI:

```bash
helm upgrade --install web podinfo/podinfo -n demo --create-namespace -f my-values.yaml
```

Every install, upgrade, and rollback creates a new revision:

```bash
helm history web -n demo
```

`helm history` lists the REVISION, status (`deployed` / `superseded` / `failed`), Chart version, and description. To go back to an earlier version:

```bash
helm rollback web 1 -n demo    # Back to revision 1
helm rollback web -n demo      # Without a number, back to the previous revision
```

Rollback doesn't delete history; it creates a **new** revision with revision 1's content. For example, if you're at revision 3, rolling back to 1 produces revision 4 with the same content as 1.

Removing a Release:

```bash
helm uninstall web -n demo
helm uninstall web -n demo --keep-history   # Keep the history so you can still roll back later
```

>[!NOTE] uninstall doesn't delete CRDs
>CRDs placed in a Chart's `crds/` folder are only created on the first install. `helm upgrade` doesn't update them and `helm uninstall` doesn't delete them, so that custom resources users created aren't deleted along with them. This comes up again in [CRDs and Operators](#crds-and-operators) below.

### helm template: render to YAML first, then apply

`helm template` renders the Chart to YAML locally only. It doesn't connect to the cluster and doesn't create a Release:

```bash
helm template web podinfo/podinfo -n demo -f my-values.yaml > podinfo.yaml
```

It's useful when:

- You want to see exactly which resources a Chart will create.
- A task asks you to "generate the YAML and save it to a file" rather than install it.
- The environment doesn't allow Helm-managed Releases, only `kubectl apply`. In that case the cluster has no Helm record, and you can't use `helm upgrade` / `rollback` afterwards.

A similar option is `--dry-run`, which goes through the whole install process without actually creating resources:

```bash
helm install web podinfo/podinfo -n demo --dry-run
```

To download a Chart to study or modify its templates, use `helm pull`:

```bash
helm pull podinfo/podinfo --untar    # Unpacks into a ./podinfo folder
helm install web ./podinfo -n demo   # Install from the local directory
```

### Helm commands commonly used in the exam

| Goal | Command |
| --- | --- |
| Add a repo | `helm repo add <name> <URL>` |
| Refresh the index | `helm repo update` |
| Search Charts | `helm search repo <keyword> [--versions]` |
| Show default values | `helm show values <chart>` |
| Install | `helm install <release> <chart> -n <ns> --create-namespace [-f values.yaml] [--set k=v] [--version x]` |
| List Releases | `helm list -A` |
| Show settings | `helm get values <release> -n <ns> [--all]` |
| Show applied YAML | `helm get manifest <release> -n <ns>` |
| Upgrade | `helm upgrade <release> <chart> -n <ns> [-f values.yaml] [--reuse-values]` |
| History | `helm history <release> -n <ns>` |
| Roll back | `helm rollback <release> [revision] -n <ns>` |
| Remove | `helm uninstall <release> -n <ns>` |
| Render YAML only | `helm template <release> <chart> -f values.yaml` |
| Download a Chart | `helm pull <chart> --untar` |

>[!TIP] 💡 Add -n to every helm command
>Without `-n` or `-A`, `helm list` only shows the current namespace, which makes it easy to think a Release has disappeared. In the exam, check the namespace the task specifies first and pass it to every command.

---

## Kustomize

![why_kustomize](https://lcxlab.com/images/posts/cka-helm-kustomize-crd/why_kustomize.webp)

### What Kustomize is: configuration management without templates

The same application usually has to be deployed to several environments, and dev, uat, and prod may differ only in namespace, replica count, image tag, and resource limits. The obvious approach is to copy the YAML three times and edit each copy, but then every change to a shared part has to be made in all three, and sooner or later they drift apart.

Helm's answer is to turn the YAML into templates and pass the differences in as values. Kustomize uses no templates at all:

- The **base** is a complete set of ordinary YAML that can be `kubectl apply`'d as is.
- An **overlay** describes only "what's different from the base". Kustomize layers it (patches it) onto the base to produce the final YAML.

Because the base is valid Kubernetes YAML on its own, there's no Go template to learn and no unreadable files full of `{{ .Values.xxx }}`. Kustomize has been built into kubectl since 1.14, so there's nothing extra to install:

```bash
kubectl kustomize <directory>    # Print the rendered YAML
kubectl apply -k <directory>     # Apply it directly
```

### Basic structure of kustomization.yaml

Kustomize works on directories. Each directory must contain a `kustomization.yaml` that says which files to read and what changes to make. Let's start with the simplest example:

```text
web/
├── kustomization.yaml
├── deployment.yaml
└── service.yaml
```

```yaml
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: nginx
        image: nginx:1.27
        ports:
        - containerPort: 80
```

```yaml
# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
  ports:
  - port: 80
    targetPort: 80
```

```yaml
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
```

Common fields:

| Field | Purpose |
| --- | --- |
| `resources` | YAML files or other kustomization directories to include |
| `namespace` | Set the namespace of every resource to this value |
| `namePrefix` / `nameSuffix` | Add a prefix / suffix to every resource name; references to those names (such as a ConfigMap a Deployment points to) are updated too |
| `labels` | Add labels to every resource |
| `commonAnnotations` | Add annotations to every resource |
| `images` | Change image names or tags without writing a patch |
| `replicas` | Change replica counts without writing a patch |
| `configMapGenerator` / `secretGenerator` | Generate ConfigMaps / Secrets from files or literals |
| `patches` | Modify existing resources with patches |

Let's add a few fields and see the effect:

```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml

namespace: demo
labels:
- pairs:
    team: platform

images:
- name: nginx
  newTag: "1.28"

configMapGenerator:
- name: web-config
  literals:
  - LOG_LEVEL=info
```

The output of `kubectl kustomize web/` changes in a few ways: every resource gets `namespace: demo` and `team: platform`, the nginx image becomes `nginx:1.28`, and there's a new ConfigMap with a name like `web-config-7g9kc6f2bt`.

>[!NOTE] Generated names include a hash
>`configMapGenerator` appends a hash of the content to the name, and places in the Deployment that reference `web-config` are automatically updated to the hashed name. When the ConfigMap's content changes, so does its name, which changes the Deployment's Pod template and triggers a rolling update. This solves the old problem of "I changed the ConfigMap but the Pods didn't restart". To turn the hash off, add `options: {disableNameSuffixHash: true}`.

>[!TIP] 💡 Old field names
>Examples online often use `commonLabels`, `patchesStrategicMerge`, and `patchesJson6902`. These are all deprecated; newer versions use `labels` and `patches` instead. The old fields still work for now but print a warning. Note that `commonLabels` changes selectors too, while `labels` only changes metadata by default; to change selectors you need `includeSelectors: true`. Changing the selector of a Deployment that's already running fails, so the new form is safer.

### Base and overlays: one configuration for different environments

Turn the `web/` from before into a base and create an overlay for each environment:

```text
web/
├── base/
│   ├── kustomization.yaml
│   ├── deployment.yaml
│   └── service.yaml
└── overlays/
    ├── dev/
    │   └── kustomization.yaml
    ├── uat/
    │   └── kustomization.yaml
    └── prod/
        ├── kustomization.yaml
        └── resources-patch.yaml
```

The base `kustomization.yaml` contains only the shared parts:

```yaml
# base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
```

An overlay points to the base with `resources` and then writes its own differences:

```yaml
# overlays/dev/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

namespace: dev
namePrefix: dev-
```

```yaml
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

namespace: prod
namePrefix: prod-

replicas:
- name: web
  count: 3

images:
- name: nginx
  newTag: "1.28"

patches:
- path: resources-patch.yaml
```

uat looks much like dev, so it isn't repeated here. Render each one and compare:

```bash
kubectl kustomize web/overlays/dev
kubectl kustomize web/overlays/prod
```

dev produces `dev-web` (1 replica, `nginx:1.27`), and prod produces `prod-web` (3 replicas, `nginx:1.28`, plus resource limits). Whatever changes in the base, every environment picks up.

>[!NOTE] The namespace must already exist
>`namespace:` only rewrites the resources' namespace field; it doesn't create the namespace. Either run `kubectl create ns dev` first, or add a Namespace YAML to the overlay's `resources`.

### Modifying existing resources with patches

For anything `replicas` and `images` can't handle, use `patches`. It supports two formats.

**1. Strategic Merge Patch**: write a "partial" YAML. `kind` and `metadata.name` identify the resource to change, and the content is merged into it. Here's the `resources-patch.yaml` used by prod above:

```yaml
# overlays/prod/resources-patch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web          # Use the name from the base; ignore namePrefix
spec:
  template:
    spec:
      containers:
      - name: nginx  # containers are merged by name, so the whole list isn't replaced
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            memory: 256Mi
```

**2. JSON 6902 Patch**: use `op`, `path`, and `value` to say exactly which field to add, replace, or remove, with `target` selecting the resource. It's good for removing fields or changing an element at a specific position in a list:

```yaml
patches:
- target:
    kind: Service
    name: web
  patch: |-
    - op: replace
      path: /spec/type
      value: NodePort
    - op: add
      path: /metadata/annotations
      value:
        owner: platform-team
```

Both can be written as separate files (`path:`) or inline in `kustomization.yaml` (`patch:`).

| | Strategic Merge Patch | JSON 6902 Patch |
| --- | --- | --- |
| Form | Partial YAML | A list of `op` / `path` / `value` |
| Selecting resources | By kind and name in the patch (a `target` can also be added) | `target` is required |
| Best for | Adding or changing fields, such as resources or env | Removing fields, changing a specific list index |

`target` can also use a `labelSelector` to modify several resources at once.

### Previewing and applying: kubectl kustomize and kubectl apply -k

```bash
# Render only, don't apply
kubectl kustomize web/overlays/prod

# Diff against the cluster's current state
kubectl diff -k web/overlays/prod

# Apply
kubectl apply -k web/overlays/prod

# Delete every resource this overlay produces
kubectl delete -k web/overlays/prod
```

`-k` means "this is a kustomization directory", as opposed to `-f` for files. Make a habit of running `kubectl kustomize` first and checking that the namespace, names, and replica counts are right before you apply.

>[!TIP] 💡 The standalone kustomize command
>Kustomize also has a standalone CLI (`kustomize build`), usually newer than the version built into kubectl. The built-in one is enough for the exam; `kubectl version --client` shows the built-in Kustomize version.

### Choosing between Helm and Kustomize

| | Helm | Kustomize |
| --- | --- | --- |
| Approach | Templates + values | Plain YAML + patches |
| Learning curve | Need to know Go templates and Chart structure | Only need to know Kubernetes YAML |
| Installation | Install `helm` separately | Built into kubectl |
| Versions and rollback | Releases, history, rollback | None; versions are managed in Git |
| Sharing and reuse | Good for packaging for others; lots of public Charts | Good for managing your own configuration |
| Typical use | Installing third-party software (ingress controllers, monitoring, cert-manager) | Deploying your own applications across environments |

In practice the two are often used together: third-party software is installed with Helm and your own applications are managed with Kustomize, or a Chart is rendered to YAML with `helm template` and in-house customizations are layered on with Kustomize. GitOps tools (Argo CD, Flux) support both.

---

## CRDs and Operators

### What a CRD is: extending the Kubernetes API

Pods, Deployments, and Services are resource types built into Kubernetes. But what if you want the cluster to understand new things like "certificates", "database clusters", or "backup schedules"? A CRD (CustomResourceDefinition) registers a new resource type with kube-apiserver.

Once registered, the new resource works almost exactly like a built-in one: you can `kubectl get`, `describe`, `apply`, and `delete` it, control access with RBAC, and its data is stored in etcd too.

- **CRD**: defines "there's a resource called CronTab, and it looks like this", like a class.
- **CR (Custom Resource)**: an actual object created from the CRD, such as a CronTab called `my-cron`, like an instance.

Create a CRD using the example from the official docs:

```yaml
# crontab-crd.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com   # Must be <plural>.<group>
spec:
  group: stable.example.com
  scope: Namespaced                   # Or Cluster
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
  versions:
  - name: v1
    served: true                      # This version is served by the API
    storage: true                     # The version stored in etcd; only one can be true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              cronSpec:
                type: string
              image:
                type: string
              replicas:
                type: integer
                minimum: 1
```

```bash
kubectl apply -f crontab-crd.yaml
```

Now you can create CronTab resources. The `apiVersion` is `<group>/<version>`:

```yaml
# my-cron.yaml
apiVersion: stable.example.com/v1
kind: CronTab
metadata:
  name: my-cron
spec:
  cronSpec: "*/5 * * * *"
  image: my-cron-image:1.0
  replicas: 1
```

```bash
kubectl apply -f my-cron.yaml
kubectl get crontabs     # crontab and ct work too
```

The `schema` validates fields on creation. If you set `replicas` to `0` or a string, for example, kube-apiserver rejects it outright.

But note: **a CRD only "stores", it doesn't "do".** After creating `my-cron`, nothing happens and no Pods are created, because no program is watching this resource. What actually makes it do something is the Operator, covered below.

### Inspecting CRDs and custom resources in the cluster

The exam more often asks you to "find the CRDs or custom resources of an Operator that's already installed in the cluster":

```bash
# List all CRDs
kubectl get crd

# Show a CRD's definition (group, versions, scope, schema)
kubectl describe crd crontabs.stable.example.com

# List resource types to find which resources a group has
kubectl api-resources --api-group=stable.example.com

# See a custom resource's fields; explain works just like with built-in resources
kubectl explain crontab.spec

# List custom resources
kubectl get crontabs -A
```

>[!TIP] 💡 Write CRs with explain
>When a task asks you to create a custom resource for some Operator and the CRD has a schema, `kubectl explain <kind>.spec --recursive` shows every field, which is faster than digging through docs.

>[!WARNING] ⚠️ Deleting a CRD deletes all its CRs
>`kubectl delete crd crontabs.stable.example.com` deletes every CronTab object along with it, and it can't be undone. This is also why Helm doesn't delete CRDs automatically on uninstall.

Clean up the example when you're done:

```bash
kubectl delete -f my-cron.yaml
kubectl delete -f crontab-crd.yaml
```

### Operators: controllers and the reconcile loop

Kubernetes itself runs on a collection of controllers. Take Deployments as an example:

1. You declare "I want 3 replicas" (the desired state), which is stored in etcd.
2. The Deployment controller watches Deployments and ReplicaSets for changes through kube-apiserver.
3. It compares the desired state with the actual state, sees only 2 Pods, and creates 1 more.
4. It repeats this "observe → compare → correct" process forever.

This cycle is called the **reconcile loop**, and it also came up in [Kubernetes Self-Healing](https://lcxlab.com/en/post/kubernetes-self-healing).

**Operator = CRD + a custom controller.** The CRD defines a new resource for users to describe a desired state, and the controller reconciles, making that desired state real. The word Operator originally meant "turning a human operator's knowledge into a program". A PostgreSQL Operator, for example, knows how to set up primary/replica, how to take backups, and how to fail over when the primary dies; users just create a `PostgresCluster` resource.

| | Built-in resources | Operator |
| --- | --- | --- |
| Resource definition | Built into Kubernetes (Deployment) | CRD (e.g. Certificate) |
| Controller | The Deployment controller in kube-controller-manager | The Operator's own Pod |
| Result | Creates ReplicaSets and Pods | Creates Secrets, StatefulSets, Jobs, etc. |

Common Operators:

- **cert-manager**: requests and renews TLS certificates automatically.
- **Prometheus Operator**: manages monitoring with resources like `Prometheus` and `ServiceMonitor`.
- **CloudNativePG** and **Strimzi**: manage PostgreSQL and Kafka respectively.
- Many CNIs also extend their configuration with CRDs, such as Calico's `IPPool` and Cilium's `CiliumNetworkPolicy`.

Operators are usually installed from a Helm Chart or an official YAML file; some are installed through OLM (Operator Lifecycle Manager) and OperatorHub.

### Installing an Operator and creating custom resources

Finally, let's tie the whole post together: install the cert-manager Operator with Helm, look at the CRDs it brings, then create custom resources so it issues a certificate for us.

**1. Install with Helm**

```bash
helm repo add jetstack https://charts.jetstack.io
helm repo update

helm install cert-manager jetstack/cert-manager \
  -n cert-manager --create-namespace \
  --set crds.enabled=true
```

`crds.enabled=true` makes the Chart install the CRDs too (in older versions the parameter was `installCRDs=true`). Check that all three components are running:

```bash
kubectl get pods -n cert-manager
```

You'll see three Pods: `cert-manager` (the main controller), `cert-manager-cainjector`, and `cert-manager-webhook`.

**2. Look at the CRDs it registered**

```bash
kubectl get crd | grep cert-manager.io
kubectl api-resources --api-group=cert-manager.io
```

You'll see resources such as `certificates`, `issuers`, `clusterissuers`, and `certificaterequests`.

**3. Create custom resources**

First create a self-signed ClusterIssuer (who signs the certificate), then a Certificate (what certificate to sign):

```yaml
# cert-demo.yaml
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: selfsigned
spec:
  selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: demo-cert
  namespace: default
spec:
  secretName: demo-cert-tls     # The Secret the signed certificate is stored in
  dnsNames:
  - demo.example.com
  issuerRef:
    name: selfsigned
    kind: ClusterIssuer
```

```bash
kubectl apply -f cert-demo.yaml
kubectl get certificate          # READY becomes True
kubectl get secret demo-cert-tls # Contains tls.crt and tls.key
```

We only created two custom resources, the ClusterIssuer and the Certificate. The `demo-cert-tls` Secret was created by cert-manager's controller on its own after it saw the Certificate.

**4. Watch the reconcile loop**

Delete the Secret and see what happens:

```bash
kubectl delete secret demo-cert-tls
kubectl get secret demo-cert-tls -w
```

A few seconds later the Secret reappears. The Certificate, the desired state, is still there, so when the controller sees the actual state is missing the Secret, it signs again. It's the same idea as a Deployment replacing a deleted Pod. `kubectl describe certificate demo-cert` shows the reissue in its Events.

**5. Clean up**

```bash
kubectl delete -f cert-demo.yaml
helm uninstall cert-manager -n cert-manager
```

As mentioned earlier, the CRDs aren't deleted with the Release; `kubectl get crd | grep cert-manager` still shows them. Once you're sure you don't need them, delete them by hand:

```bash
kubectl get crd -o name | grep cert-manager.io | xargs kubectl delete
kubectl delete ns cert-manager
```

---

## Summary

- Helm is the package manager for Kubernetes: a Chart is the package, a Repository is the source, and a Release is an installed instance. Values precedence is Chart defaults → `-f` → `--set`.
- `helm upgrade` doesn't keep last time's `--set` by default; add `--reuse-values` or pass the same values file every time. `helm rollback` creates a new revision.
- `helm template` only renders YAML and doesn't create a Release; remember `-n` on every helm command.
- Kustomize uses no templates: the base is ordinary YAML and overlays only describe differences. Preview with `kubectl kustomize`, apply with `kubectl apply -k`.
- Use `namespace`, `namePrefix`, `images`, and `replicas` for simple changes and `patches` (Strategic Merge or JSON 6902) for everything else; the hash suffix from `configMapGenerator` makes ConfigMap changes trigger a rolling update.
- Use Helm for third-party software and Kustomize for your own multi-environment configuration; the two work well together.
- A CRD registers a new resource type with kube-apiserver and only handles storage and validation; an Operator is a CRD plus a controller, using a reconcile loop to turn the desired state into the actual state.
- Deleting a CRD deletes all its custom resources, and Helm uninstall doesn't delete CRDs automatically.

---

## References

[1] Helm - Using Helm - https://helm.sh/docs/intro/using_helm/

[2] Helm - Installing Helm - https://helm.sh/docs/intro/install/

[3] Helm - Custom Resource Definitions - https://helm.sh/docs/chart_best_practices/custom_resource_definitions/

[4] Kubernetes - Declarative Management of Kubernetes Objects Using Kustomize - https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/

[5] Kustomize - kustomization reference - https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/

[6] Kubernetes - Custom Resources - https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

[7] Kubernetes - Extend the Kubernetes API with CustomResourceDefinitions - https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/

[8] Kubernetes - Operator pattern - https://kubernetes.io/docs/concepts/extend-kubernetes/operator/

[9] cert-manager - Helm installation - https://cert-manager.io/docs/installation/helm/

[10] podinfo - https://github.com/stefanprodan/podinfo
