Deploying PostgreSQL to Kubernetes is relatively easy. But what about failover, backup, scaling, upgrades? All of that was traditionally done by a DBA manually. Kubernetes Operators promise to automate these operations.
What Is an Operator¶
An Operator is a Kubernetes controller that understands the domain of a specific application. Instead of a generic “ensure 3 replicas,” an Operator knows how to properly perform a PostgreSQL failover or add a replica to an Elasticsearch cluster.
How an Operator Works¶
Technically, an Operator is a combination of a Custom Resource Definition (CRD) and a custom controller.
apiVersion: postgres.core.cz/v1alpha1
kind: PostgreSQLCluster
metadata:
name: orders-db
spec:
version: "9.6"
replicas: 3
storage:
size: 50Gi
backup:
schedule: "0 2 * * *"
retention: 7d
Prometheus Operator — Our First Production Operator¶
The CoreOS Prometheus Operator is excellent. Instead of manually configuring Prometheus, you define ServiceMonitor objects that the Operator automatically translates into scrape configurations. New service? Create a ServiceMonitor.
The Future¶
Operators are the future of running complex applications in Kubernetes. Instead of runbooks and on-call shifts, Operators will automatically handle most operational scenarios.
Operators = Next-Generation DevOps Automation¶
Kubernetes Operators transfer operational knowledge from human heads into code. Start with existing Operators and gradually learn the pattern for your own applications.
Need help with implementation?
Our experts can help with design, implementation, and operations. From architecture to production.
Contact us