Skip to main content

Operators and Controllers

Why Operators

Picture a greenhouse. Plants (applications) need watering, pruning, and care. You could do it manually, but it’s error‑prone and time‑consuming. Kubernetes workloads face the same challenge: complex applications like databases or monitoring stacks need constant upkeep.

Operators and Controllers were born as the gardeners of Kubernetes, automating the lifecycle of applications using custom logic.


Controllers – The Watchers

  • Definition: Controllers continuously watch Kubernetes resources and reconcile the desired state with the actual state.
  • Examples:
    • Deployment Controller ensures the right number of pods.
    • ReplicaSet Controller maintains replicas.
    • Node Controller monitors node health.
Analogy: Controllers are like greenhouse sensors, constantly checking temperature, humidity, and plant health.

Operators – The Gardeners

  • Definition: Operators are application‑specific controllers built using CRDs.
  • Key Features:
    • Automate complex tasks (backups, upgrades, scaling).
    • Extend Kubernetes with domain‑specific knowledge.
    • Manage stateful applications like databases.
  • Examples:
    • Prometheus Operator.
    • MySQL Operator.
    • Kafka Operator.
Analogy: Operators are like expert gardeners, not only sensing conditions but actively watering, pruning, and fertilizing plants.

Global Context

  • Enterprises: Use operators to manage mission‑critical apps (databases, monitoring, messaging).
  • Cloud Providers: Ship operators for managed services (e.g. AWS RDS Operator, GCP Config Connector).
  • Community: Operators are a CNCF innovation, powering extensibility and automation worldwide.

Hands‑On Exercise

  1. Observe: The operator automatically deploys Prometheus pods, manages scaling, and ensures health.
  2. Reflect: How do controllers maintain desired state, and how do operators extend this to application‑specific automation?

Create a Prometheus custom resource:

apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  name: prometheus-demo
spec:
  replicas: 2

Install Prometheus Operator:

kubectl apply -f https://github.com/prometheus-operator/prometheus-operator/blob/main/bundle.yaml

The Hacker’s Notebook

  • Controllers ensures desired state.
  • Operators automate application lifecycle.
  • Lesson for engineers: Don’t babysit apps and let operators manage them.
  • Hacker’s mindset: Treat operators as your expert gardeners. With them, you can grow complex workloads effortlessly.

Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 30, 2025