What is Kubernetes operator pattern?
Answer
A Kubernetes Operator is a method of packaging, deploying, and managing a Kubernetes application — specifically stateful applications that require domain knowledge to manage correctly. Operators encode operational expertise into software that automates management of complex applications. Core concept: an Operator extends the Kubernetes API with custom resources (CRDs) and a controller that watches those resources and reconciles actual state to desired state. Example — Database Operator: define a PostgreSQLCluster CRD. Operator watches for PostgreSQLCluster objects → provisions primary + replicas, configures replication, handles failover, manages backups, handles scaling, performs rolling upgrades. The operator knows HOW to manage PostgreSQL; the user just declares WHAT they want: apiVersion: postgres.example.com/v1 kind: PostgreSQLCluster metadata: name: my-db spec: replicas: 3 version: "15" storage: 100Gi backupSchedule: "0 2 * * *". Building operators: Operator SDK: scaffold operator project, generate CRD manifests, Ansible/Helm/Go operators. Kubebuilder: framework for building operators in Go. KUDO: declarative operators with YAML. Level of operator maturity (Capability Model): Level 1: Basic Install; Level 2: Upgrades; Level 3: Full Lifecycle (backup/restore); Level 4: Deep Insights (metrics, alerts); Level 5: Auto Pilot (auto-scaling, self-healing, self-tuning). Production operators: Prometheus Operator (installs Prometheus, Alertmanager via CRDs), Cert-Manager (manages TLS certificates), External Secrets Operator, Argo CD, PostgreSQL operators (CloudNativePG, CrunchyData PGO), Kafka operators (Strimzi, Confluent).
Previous
What is etcd in Kubernetes and how to back it up?
Next
What is Kubernetes custom resources and CRDs?
More Kubernetes (K8s) Questions
View all →- Advanced What is the Kubernetes scheduler and custom scheduling?
- Advanced What is etcd in Kubernetes and how to back it up?
- Advanced What is Kubernetes custom resources and CRDs?
- Advanced What is Kubernetes advanced networking with eBPF (Cilium)?
- Advanced What is Kubernetes StatefulSet advanced patterns?