Core components of a Kubernetes Operator
operator architecture.
a CRD defines the type, a controller watches instances via the API server and runs a reconcile loop, encoding operational knowledge to drive real state.
What's really being asked
Whether you understand an operator as the combination of a custom type plus a controller that continuously drives reality toward the declared spec.
The full answer
An operator has two core parts. First, one or more Custom Resource Definitions that introduce new resource kinds, for example a PostgresCluster, defining the desired-state schema. Second, a controller, a long-running process usually deployed as a Deployment in the cluster, that watches instances of those custom resources through the Kubernetes API server. The controller does not poll naively; it uses informers and a shared cache to receive add, update, and delete events efficiently, placing changed object keys onto a work queue. A reconcile function then pulls keys off the queue and, for each, reads the desired spec, observes the actual state of managed resources, and takes action through the API server to converge them, creating Deployments, Services, or external resources as needed. It writes observed state back to the resource's status subresource. The operator thus encodes the operational knowledge a human SRE would apply, automating day-two tasks.
The mistakes people make
Describing only the CRD and forgetting the controller, omitting informers and the reconcile loop, or treating the operator as a one-time installer rather than a continuous reconciler.
What usually comes next
What are informers and the work queue? How is status updated? What frameworks (Operator SDK, Kubebuilder, controller-runtime) help build operators?
A concrete example
An operator defines a Redis CRD. Its controller, running as a pod, watches Redis objects via the API server. When you create a Redis instance requesting three replicas, an event hits the controller's queue; reconcile reads the spec, creates a StatefulSet and Service, then updates the Redis object's status with the ready replica count, looping again whenever the spec or managed resources change.
Interview question
Which pair best describes the two core components that make up a Kubernetes Operator?
- a.One or more CRDs defining custom resources plus a controller that watches and reconciles themCorrect
- b.A ConfigMap of settings plus a CronJob that reads it
- c.An Ingress controller plus a service mesh sidecar
- d.A Helm chart plus a CI/CD pipeline that applies it
Why? this is the answer
An operator combines a custom resource type (the CRD) with a controller that watches instances via the API server and reconciles desired against actual state. Helm, CronJobs, or meshes are unrelated to that core pairing.
Just read this? Test yourself on what you have been reading.
Read the original → kubernetes.io
- #kubernetes
- #operators
- #controller
- #reconciliation
- #crd
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on kubernetes — each one lists the topics its interview covers.
See open roles