Operator

πŸ”§ Problem Operators Solve

❌ The Problem

Kubernetes manages stateless apps (like NGINX, APIs) easily via Deployments and Services. But stateful apps (like databases) need:

  • Backups

  • Restores

  • Scaling with persistent volume migration

  • Health checks + failover

  • Version-aware upgrades

Manually doing this is error-prone and non-repeatable.

Operators can be simple (e.g., restart app if it crashes) or advanced (e.g., auto-backup before upgrade).

πŸ”„ Real-Time Example

🐘 Example: PostgreSQL Operator

Problem: PostgreSQL isn’t natively supported in Kubernetes for:

  • Safe backup/restore

  • Replication/failover

  • Version upgrades

  • PVC migration

Solution: Use an Operator like Zalando Postgres Operatorarrow-up-right

πŸ’‘ What It Does:

  • Deploys PostgreSQL clusters using a CRD like:

  • Automatically:

    • Creates StatefulSets with correct configs

    • Sets up replication

    • Monitors health

    • Performs failover

    • Manages backups (e.g., to S3)


πŸ“š Operator Examples in Production

Operator

Manages

Features

Prometheus Operator

Prometheus, Alertmanager

Auto config, upgrades, alerting

Cert-Manager

TLS certs via Let's Encrypt

Auto renewals, validation

ArgoCD Operator

GitOps CD tool

Installs and maintains ArgoCD

Elastic Operator

Elasticsearch & Kibana

Handles cluster upgrades, scaling, snapshots

Kafka Operator

Apache Kafka

Handles topics, partitions, failover, scaling


🧠 Summary

Concept

Description

CRD

Custom resource you define (e.g., PostgreSQL)

Controller

Logic to watch CRD and take action

Operator

Combination of CRD + controller logic, often packaged as a Helm chart or container

Why Use It?

To manage complex, stateful, or repetitive workloads like a human would

Last updated