Choose between a Helm chart and an operator
In this task you'll decide whether an app needs a Helm chart, an operator, or both.
A Helm chart is a package of templated YAML: it installs and upgrades an app, and then its job is done. An operator is a custom controller plus custom resources (CRDs): it keeps running in the cluster and handles day-2 work by itself, such as backups, failover, scaling and version upgrades for something like a database.
Use Helm for stateless apps and most of your own services. Use (or buy) an operator for complex stateful software where a person would otherwise follow a long runbook. Operators are often installed with Helm, so it's not either-or.
Example. Kestwick Hotels installs its booking web app with a Helm chart. Its PostgreSQL clusters run under an operator: a PostgresCluster resource says 3 instances and nightly backups, and the operator handles failover when a node dies.
Before you start
You need: Nothing. Time: 20 minutes.
Where to look
- Terminal
- kubectl
- helm
Steps
- List the custom resource types in a cluster:
kubectl get crd. - For one app, list its day-2 jobs (backup, failover, upgrade) and who does them now.
- If a person follows a long runbook for them, look for a mature operator; otherwise a Helm chart is enough.
- Check an operator's project health, version support and permissions before you trust it with data.
Commands
kubectl get crd
kubectl api-resources --api-group=<group>
helm list -A
Watch out for
- Cost
- Operators are usually free software, but some need commercial licences.
- Security
- Operators often need wide cluster permissions: read their RBAC before installing.
- Common mistakes
- Writing your own operator for something a Helm chart and a CronJob would handle.
Clean up
Nothing to clean up.
Words to know
- Operator
- A custom controller that manages an application through custom resources, including day-2 tasks.
- Custom resource definition (CRD)
- An extension that adds a new resource type, such as PostgresCluster, to the Kubernetes API.
- Day-2 operations
- Work after installation: backups, upgrades, scaling, failover.
Tick off each step and track your progress in the guide.
Open this task in DevOps, Hands On