Skip to content

Kubernetes Operator

Key idea:

Kubernetes Operator — pattern (+ tooling) for packaging complex stateful applications as native K8s resources. Operator = Custom Resource Definition (CRD) + Controller that reconciles desired state. Examples: Postgres-operator (provisions PostgreSQL clusters + backups), Redis Operator, Kafka Strimzi, cert-manager (SSL automation). OperatorHub.io — registry of 200+ operators.

Below: details, example, related terms, FAQ.

Details

  • CRD: defines your custom resource type (e.g. PostgresCluster)
  • Controller: watches CRD, performs reconciliation
  • Frameworks: Operator SDK (Go), Kopf (Python), kubebuilder
  • Capability levels: Basic Install → Seamless Upgrades → Full Lifecycle → Deep Insights → Auto-Pilot
  • Popular ones: cert-manager, Prometheus Operator, Strimzi (Kafka), CloudNativePG

Example

# Custom resource (Postgres Operator)
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: my-pg
spec:
  instances: 3
  storage:
    size: 100Gi
  backup:
    barmanObjectStore:
      destinationPath: s3://backups/
      s3Credentials:
        accessKeyId:
          name: backup-key
          key: ACCESS_KEY

Related Terms

Learn more

Frequently Asked Questions

Operator vs Helm chart?

Helm — install + upgrade templates. Operator — ongoing management (backup, scale, heal). Operator — higher automation.

When to write your own operator?

If you deploy a complex stateful app and need automation for backups, failover, schema migrations. Simple stateless app — Deployment is enough.

Testing operators?

Operator SDK has an e2e test framework. kind/minikube local clusters for reconciliation testing.