We use optional first-party traffic analytics to improve the blog. You can accept or decline — nothing is measured before you choose.

Privacy policy

Skip to content
NyverraNyverra
⌘K
HomeArticlesCorporate site
🇺🇸
Nyverra

Editorial channel

Articles on technology, operations and partners — infrastructure, monitoring and critical environments.

Social media

Explore

  • Home
  • Articles
  • Categories
  • Tags
  • Authors
  • About
  • Contact
  • RSS
  • Corporate site

Nyverra

  • Our services
  • Case studies
  • Partners

Contact

Email[email protected]WhatsApp(62) 99309-1592Client portalITSM · tickets and SLA

Rua RB 18, S/N — Casa 01, Sala 01 · Residencial Buriti · Senador Canedo – GO, Brazil · ZIP 75260-459

Hours: Mon–Fri, 8am–6pm

© 2026 Nyverra. All rights reserved.

CNPJ: 61.571.209/0001-08 · State registration: 20.291.265-5 · D-U-N-S®: 57-323-5796

blog.nyverra.com.br

Terms of usePrivacyCookies
Back to top
  1. Home
  2. Kubernetes
  3. Kubernetes Operators: What They Are and Why Use Them
Kubernetes
#Kubernetes#Curso Kubernetes#K8S

Kubernetes Operators: What They Are and Why Use Them

Wedson LopesWedson Lopes
31 de outubro de 20264 min de leitura

A database in Kubernetes doesn't need only a Pod and a PVC. It needs failover, backup, restore, upgrade, replica, monitoring, and disaster recovery. Packaging all of this in YAML is unsustainable.

An operator is the answer: a controller that encodes the operational knowledge of an application.

Course seal: tested on Kubernetes 1.35 with CloudNativePG, ECK, MinIO, RabbitMQ, and Redis.

The core idea

An operator extends the Kubernetes API with a CRD (CustomResourceDefinition) and a controller that reconciles the desired state.

CRD (novo tipo) → CR (seu pedido) → controller (reconcilia) → recursos reais

Example: instead of creating Deployment + Service + PVC + failover scripts, you create a CloudNativePG Cluster and the operator does the rest.

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: portal-postgres
spec:
  instances: 2
  storage:
    size: 10Gi

Anatomy of an operator

Component Role
CRD defines the new type and its fields
CR instance of the type (your request)
Controller reconciliation loop
RBAC controller permissions
Webhooks validation/mutation
Finalizers cleanup before deletion

The controller runs a loop: it observes the current state, compares it with the desired state, and acts. If a pod dies, it recreates it. If the primary fails, it promotes the replica. If the backup fails, it records status.

Operators we use

Operator Resource What it manages
CloudNativePG Cluster PostgreSQL HA, backup, failover
ECK Elasticsearch Elasticsearch cluster
MinIO Operator Tenant object storage
RabbitMQ Cluster Operator RabbitmqCluster quorum queues
Spotahome Redis Operator RedisFailover Redis with Sentinel

When to use it (and when not)

Use an operator when:

  • The application has state and a complex lifecycle (database, queue, storage).
  • You need HA, backup, and upgrade safely.
  • The community actively maintains the operator.

Avoid when:

  • A Deployment + Service suffices (stateless).
  • The operator is abandoned or incompatible with your version.
  • You don't understand what it does: an operator is not a black box.

An operator is not magic

It does not replace:

  • Tested backup (restore is yours).
  • Planned capacity.
  • Incident runbook.
  • Understanding of the database.

It automates what you already know how to do. If you don't know what a failover is, the operator will just fail faster.

Operator + GitOps

The mature way: operator installed via Helm/ArgoCD and CRs versioned in Git.

infra/operators/cloudnative-pg/   # helm/argocd
apps/portal/postgres-cluster.yaml # CR

Changes go through PR, review, and sync. No kubectl edit in production.

Lab

  1. List the CRDs:
kubectl get crd | grep -E 'cnpg|elastic|minio|rabbitmq|redis'
  1. See the running operators:
kubectl get pods -A | grep -E 'cnpg|elastic|minio|rabbitmq|redis'
  1. Inspect a CR and its status:
kubectl -n portal-cliente get cluster.postgresql.cnpg.io portal-postgres
kubectl -n portal-cliente get cluster.postgresql.cnpg.io portal-postgres -o yaml | less
  1. Observe the status: ready instances, primary, conditions.

  2. (Lab) Delete a replica and watch the operator recreate it:

kubectl -n portal-cliente delete pod portal-postgres-2
kubectl -n portal-cliente get pods -w

Common errors

Symptom Cause
CR Pending operator not installed or lacking permission
Operator in CrashLoopBackOff incompatible version or broken webhook
CR accepted but nothing happens controller is not running
no matches for kind CRD not installed
Stuck finalizer external resource not removed
Upgrade broke CRD/version incompatible with the operator

Checklist

  • [ ] I know which operators run in the cluster.
  • [ ] I know which CRD each one adds.
  • [ ] CRs are in Git, not hand-edited.
  • [ ] Operator has a planned upgrade.
  • [ ] Backup/restore tested independently of the operator.
  • [ ] I understand the CR status/conditions.
  • [ ] I have a runbook for the operator being down.

Glossary

  • CRD: definition of a new resource type.
  • CR: instance of a CRD.
  • controller: loop that reconciles state.
  • reconciliation: desired vs. actual comparison.
  • finalizer: cleanup hook before deletion.
  • webhook: validation/mutation in the API.

Next

Now let's go to the most important operator in our stack: PostgreSQL with CloudNativePG — HA, failover, backup, and restore in practice.

Next: Kubernetes Course 15 — Postgres with CloudNativePG: HA, failover, and backup

Share

Keep reading

Read also

  • Kubernetes for Real — from Zero to Production Cluster
    Kubernetes

    Kubernetes for Real — from Zero to Production Cluster

    A practical path to understand, set up, and operate a Kubernetes cluster — from the first pod to Postgres failover.

    31 de outubro de 20264 min de leitura
  • Kubernetes Course 28 — DR and Capstone: Proving the Cluster Comes Back
    Kubernetes

    Kubernetes Course 28 — DR and Capstone: Proving the Cluster Comes Back

    RPO, RTO and real drills: disaster scenarios, runbook, measured restore and the capstone that closes the course with a cluster that recovers.

    31 de outubro de 20265 min de leitura
  • Kubernetes Course 27 — SLO/SLI, On-Call and Blameless Postmortem
    Kubernetes

    Kubernetes Course 27 — SLO/SLI, On-Call and Blameless Postmortem

    What to promise, how to measure, and what to do when errors exceed: SLI, SLO, error budget, alerts that wake someone up, and postmortem without witch hunts.

    31 de outubro de 20264 min de leitura

Nyverra

Need specialist help?

  • Infrastructure services
  • Case studies
  • Partners

Comments

No comments yet

Be the first to share your thoughts on this article.

Leave a comment

Newsletter

Get new articles

Subscribe to receive Nyverra blog posts in your inbox. We will send a confirmation link.

​