
Operators encapsulate operational expertise (backups, upgrades, failover, certificate lifecycle, etc.) as controllers that reconcile Kubernetes custom resources with a running system. Use
CustomResourceDefinitions and controllers to declare intent and let the operator maintain the implementation.- You create a
Certificatecustom resource to declare the TLS certificate you need. - The cert-manager operator watches that
Certificate, requests or renews the certificate from an issuer (for example ACME/Let’s Encrypt), and stores the resulting key material in aSecret. - Applications consume the
Secretto enable HTTPS and mutual TLS.

- Instead of hand-editing Prometheus scrape configuration files, you create higher-level resources like
ServiceMonitororPodMonitor. - The operator watches these objects and updates Prometheus’ configuration automatically so the monitoring system stays aligned with declared intent.

- A PostgreSQL operator watches a
PostgresCluster(or similarly named custom resource) and manages the full lifecycle of a database cluster: creating and reconcilingStatefulSetobjects, performing backups, orchestrating failover, and coordinating upgrades. - A
StatefulSetis the Kubernetes workload type used for pods that need

- The user writes a custom resource such as
Certificate,ServiceMonitor, a PostgreSQL cluster resource, or a Kafka cluster resource. - A controller (the operator) watches that resource and detects when the real system diverges from the declared state.
- The controller creates or updates lower-level Kubernetes objects (for example
Deployment,StatefulSet,Service,ConfigMap,Secret) and performs application-specific actions to reconcile the system.

- In this learning example the custom resource is
WebApp. - The controller reconciles the
WebAppresource by creating aDeployment, aService, and aConfigMap.Deployment: runs the application pods and manages rollouts.Service: provides a stable network name and load-balancing.ConfigMap: stores non-sensitive configuration consumed by pods.

Links and references
- cert-manager
- Prometheus Operator
- Prometheus
- PostgreSQL
- Strimzi for Kafka
- Kubernetes concepts: StatefulSet
When designing operators, be careful with permissions and automated actions: reconciliations that modify persistent state (databases, storage, certificates) require thorough testing, RBAC scoping, and clear upgrade/backup strategies.