75+ Kubernetes Operators Interview Questions (2027)
76 Kubernetes Operator interview questions with answers on CRDs, reconcile loops, finalizers, Operator SDK, Kubebuilder, OLM and production design.
Kubernetes Operator interview questions check whether you understand how a custom controller watches a Custom Resource and reconciles the cluster toward the desired state. This set has 76 numbered questions with direct answers on CRDs, reconcile loops, Operator SDK, Kubebuilder, OLM, testing and production design, grouped by experience level with scenario questions at the end.
Operators sit on top of core Kubernetes, so review the Kubernetes architecture components first if the control plane is still fuzzy. This post is the main Operators question bank; the advanced Kubernetes Operators questions go deeper into controller-runtime internals.
Key takeaways
- An Operator is a CRD plus a controller that encodes operational knowledge for one application, following the pattern described in the Kubernetes documentation.
- Reconcile functions must be idempotent and level based: read current state, compare with spec, act, update status, and requeue when needed.
- Operator SDK supports Go, Ansible and Helm operators; Kubebuilder is the Go framework that Operator SDK's Go projects build on.
- Production questions focus on finalizers, owner references, status conditions, CRD versioning, RBAC scope and leader election.
- Many teams should install an existing Operator before writing one. Say so in interviews.
Operator building blocks at a glance
| Piece | What it does | Interview angle |
|---|---|---|
| CustomResourceDefinition (CRD) | Adds a new API type to the cluster | Schema validation, versions, subresources |
| Custom Resource (CR) | An instance of that type holding desired state | spec vs status |
| Controller | Watches resources and reconciles | Idempotency, requeue, events |
| controller-runtime | Go library for managers, caches, clients | Informers, work queues |
| Operator SDK / Kubebuilder | Scaffolding and tooling | Project layout, make targets |
| Operator Lifecycle Manager (OLM) | Installs and upgrades Operators | Bundles, catalogs, channels |
Kubernetes Operator interview questions for freshers
1. What is a Kubernetes Operator?
An Operator is a software extension that uses custom resources and a custom controller to manage an application and its components. It automates tasks a human operator would do, such as deployment, scaling, backup and upgrade, using the Kubernetes API.
2. What is the Operator pattern?
The pattern combines a Custom Resource that describes the desired state of an application with a controller that keeps the real state matching it. The Kubernetes documentation describes it as a way to capture the knowledge of someone operating a service.
3. What is a CustomResourceDefinition?
A CRD registers a new resource type with the API server, with a group, version, kind and an OpenAPI v3 schema. After it is applied, you can create, list and watch objects of that kind with kubectl like built-in resources.
4. What is the difference between a CRD and a Custom Resource?
The CRD defines the type, like a class. A Custom Resource is an object of that type, like an instance. For example, a PostgresCluster CRD and a CR named orders-db.
5. What is a controller in Kubernetes?
A controller is a control loop that watches the state of resources through the API server and makes changes to move the current state toward the desired state. The Deployment controller, for example, manages ReplicaSets.
6. How is an Operator different from a regular controller?
Built-in controllers manage generic resources like Pods and Deployments. An Operator is a controller for a custom resource that carries domain knowledge about one application, such as how to fail over a database or take a consistent backup.
7. What are spec and status in a custom resource?
spec is the desired state written by the user. status is the observed state written by the controller. Users should not edit status, and controllers should not change spec.
8. What is reconciliation?
Reconciliation is the controller's process of reading the desired state, observing the actual state and taking the actions needed to make them match. It runs whenever a watched object changes and can also be scheduled to repeat.
9. What does "level based" mean for controllers?
The controller acts on the current state, not on the sequence of events. If it misses events, the next reconcile still sees the full current state and fixes it. This makes controllers resilient to restarts and dropped watches.
10. Why must reconcile be idempotent?
Reconcile can run many times for the same state, after restarts, resyncs or retries. Running it twice must not create duplicate resources or repeat destructive actions, so it should check before it creates or changes anything.
11. Name some well-known Operators.
Prometheus Operator (from the prometheus-operator project), cert-manager, Strimzi for Apache Kafka, and the CloudNativePG operator for PostgreSQL are widely used examples. Many are listed on OperatorHub.io.
12. What is OperatorHub.io?
OperatorHub.io is a public registry of Kubernetes Operators packaged for installation with the Operator Lifecycle Manager. OpenShift includes an OperatorHub view in its web console.
13. What is Operator SDK?
Operator SDK is part of the Operator Framework. It provides a CLI and libraries to scaffold, build, test and package Operators written in Go, Ansible or Helm.
14. What is Kubebuilder?
Kubebuilder is a Kubernetes SIG project that scaffolds Go-based controllers and APIs using controller-runtime and controller-tools. Operator SDK's Go projects use the Kubebuilder project layout.
15. What are the three Operator types Operator SDK supports?
Go operators give full control and suit complex logic. Ansible operators run Ansible roles or playbooks on changes to a CR. Helm operators install and upgrade a Helm chart based on the CR's spec.
16. When would you choose a Helm-based Operator?
When you already have a working Helm chart and mostly need install and upgrade driven by a CR. Helm operators are quick to build but limited for actions like backup, failover or custom status logic.
17. What are the Operator capability levels?
The Operator Framework defines five levels: Basic Install, Seamless Upgrades, Full Lifecycle, Deep Insights and Auto Pilot. They describe how much of an application's operations an Operator automates.
18. What is the Operator Lifecycle Manager?
OLM installs, upgrades and manages Operators and their dependencies on a cluster. It reads Operator bundles from catalogs, and lets you subscribe to an update channel for each Operator.
19. How do you list CRDs on a cluster?
kubectl get crd. Use kubectl explain kind.spec to read the schema of a custom resource, and kubectl api-resources --api-group=example.com to see the kinds in a group.
20. What is an API group and version in a CRD?
The group (for example cache.example.com) namespaces your types. The version (such as v1alpha1, v1beta1, v1) signals stability. Objects are addressed by group, version and kind (GVK).
21. Can a CRD be namespaced or cluster scoped?
Yes. The scope field is Namespaced or Cluster. Most application CRs are namespaced; cluster-wide settings, such as a cert-manager ClusterIssuer, are cluster scoped.
22. What does a minimal CRD look like?
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: memcacheds.cache.example.com
spec:
group: cache.example.com
names:
kind: Memcached
plural: memcacheds
singular: memcached
scope: Namespaced
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
size:
type: integer
minimum: 1
subresources:
status: {}
23. Why should you enable the status subresource?
With subresources.status enabled, status is updated through a separate endpoint. Users updating spec cannot overwrite status, controllers update status without bumping spec, and RBAC can separate the two.
24. What is the scale subresource?
It maps a replica count in your CR to the standard scale API, so kubectl scale and the HorizontalPodAutoscaler can work with the custom resource. You define the spec and status paths for replicas.
25. How do Operators get permission to manage resources?
Through a ServiceAccount bound to Roles or ClusterRoles. In Kubebuilder and Operator SDK Go projects, // +kubebuilder:rbac markers on the controller generate the RBAC manifests when you run make manifests.
Kubernetes Operator interview questions for 2-5 years experience
26. How do you scaffold a Go Operator with Operator SDK?
operator-sdk init --domain example.com --repo github.com/example/memcached-operator
operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
make generate
make manifests
make generate updates generated code such as DeepCopy methods; make manifests regenerates CRDs and RBAC from markers.
27. How do you run and deploy the Operator during development?
make install applies the CRDs, make run runs the controller locally against your current kubeconfig, and make docker-build docker-push IMG=... followed by make deploy IMG=... deploys it into the cluster.
28. What is controller-runtime?
A Go library from Kubernetes SIGs that provides the Manager, cached clients, controllers, webhooks and leader election used by Kubebuilder and Operator SDK. It wraps client-go informers and work queues.
29. What does the Manager do?
The Manager starts and coordinates controllers and webhooks, provides shared caches and clients, serves health and metrics endpoints, and handles leader election.
30. What is the signature of a reconcile function in controller-runtime?
func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
The request contains only the namespaced name of the object, not the event. The function fetches the object, reconciles, and returns a result that can request a requeue.
31. What do the reconcile return values mean?
Returning an error requeues with rate-limited backoff. ctrl.Result{RequeueAfter: d} requeues after a set time, useful for polling external systems. An empty result and nil error means done until the next event.
32. What should you do when the CR is not found during reconcile?
Treat it as deleted and return without error, usually using client.IgnoreNotFound(err). Owned objects get removed by garbage collection if you set owner references.
33. What are owner references?
Owner references on child objects point to the parent CR. Kubernetes garbage collection deletes the children when the owner is deleted, and controllers can watch owned objects to trigger reconcile of the owner. Use controllerutil.SetControllerReference.
34. How do you make the controller react to changes in child resources?
In SetupWithManager, use For(&Memcached{}) for the primary type and Owns(&appsv1.Deployment{}) for children. Changes to an owned Deployment then queue a reconcile for its owning CR.
35. What is a finalizer and why do Operators use one?
A finalizer is a key in metadata.finalizers that blocks deletion until it is removed. Operators add one so they can clean up external resources, such as a cloud database or DNS record, before the CR disappears.
36. How does finalizer handling work in reconcile?
If deletionTimestamp is not set, add your finalizer if missing. If it is set and your finalizer is present, run cleanup, then remove the finalizer and update the object. Kubernetes then deletes it.
37. What are status conditions?
Conditions are a list of typed status entries, such as Ready or Degraded, each with status True, False or Unknown, a reason, message, last transition time and observedGeneration. They follow the Kubernetes API conventions and are easy for tools to read.
38. What is observedGeneration used for?
metadata.generation increases when spec changes. Writing the generation you reconciled into status (or into each condition) lets users and tools tell whether the status reflects the latest spec.
39. How do you validate CR input?
Use the OpenAPI schema: types, required fields, minimum and maximum, enums and patterns, generated from +kubebuilder:validation markers. CEL validation rules (x-kubernetes-validations) handle cross-field checks. Use a validating webhook only for checks the schema cannot express.
40. What are admission webhooks in Operators?
Mutating webhooks set defaults or modify objects on create or update; validating webhooks reject invalid objects. Kubebuilder scaffolds them with create webhook. They need TLS certificates, often provided by cert-manager.
41. How do you version a CRD API?
Add a new version to the CRD, mark exactly one version as storage: true, keep older versions served while clients migrate, and provide conversion. Promote from alpha to beta to v1 as the API stabilises.
42. What is a conversion webhook?
When versions have different schemas, the API server calls a conversion webhook to convert objects between the stored version and the requested version. With identical schemas you can use the None strategy.
43. What is leader election and why does an Operator need it?
If you run more than one replica for availability, only one should reconcile at a time to avoid conflicting writes. Leader election uses a Lease object so one replica acts while the others wait.
44. Why does the controller read from a cache?
controller-runtime's client reads from informer caches to reduce load on the API server. The cache can be slightly stale, so reconcile must tolerate it, and writes go directly to the API server.
45. How do you handle update conflicts?
Kubernetes uses optimistic concurrency with resourceVersion. If an update returns a conflict, re-fetch and retry, or return the error and let the next reconcile try again. Patching only the fields you own reduces conflicts.
46. What is server-side apply and when do Operators use it?
Server-side apply lets a client declare the fields it manages, with the API server tracking field ownership. Operators use it to manage child objects without overwriting fields set by other controllers or users.
47. How do you limit the namespaces an Operator watches?
Configure the Manager's cache to watch specific namespaces instead of the whole cluster, and grant Roles in those namespaces rather than a ClusterRole. This narrows both the blast radius and the RBAC.
48. How do you emit Kubernetes Events from an Operator?
Use an EventRecorder from the Manager and record Normal or Warning events on the CR, such as "BackupCompleted" or "ScalingFailed". Users see them in kubectl describe.
49. How do you expose Operator metrics?
controller-runtime serves Prometheus metrics, including reconcile counts, errors and durations. Register custom metrics for domain events, and scrape them with a ServiceMonitor if you use the Prometheus Operator.
50. How do you test an Operator?
Unit test helper logic, use envtest (from controller-runtime) to run a real API server and etcd locally for controller tests, and run end-to-end tests on a kind cluster. Operator SDK also offers operator-sdk scorecard to check bundles.
51. What is envtest?
envtest starts a local kube-apiserver and etcd without kubelets, so you can apply CRDs and run your reconciler against a real API. Pods do not actually run, so test status logic rather than workloads.
52. What is an Operator bundle?
A bundle is an image containing the manifests OLM needs for one Operator version: the ClusterServiceVersion, CRDs and metadata. make bundle generates it in Operator SDK projects.
53. What is a ClusterServiceVersion?
The CSV describes one Operator version for OLM: its deployment, permissions, owned and required CRDs, install modes, description and icon. OLM uses it to install and upgrade the Operator.
54. What are OLM channels and subscriptions?
A catalog groups Operator versions into channels, such as stable or fast. A Subscription tells OLM which channel to follow and whether to approve upgrades automatically or manually.
55. How do Ansible Operators map CRs to Ansible?
A watches.yaml file maps each group, version and kind to a role or playbook. When a CR changes, the Operator runs that Ansible content with the CR's spec fields passed as variables.
Senior Kubernetes Operator interview questions
56. When should you not write an Operator?
When a Helm chart, a plain controller-free manifest, or an existing community Operator already solves the problem. An Operator is code you must maintain, test and upgrade. It pays off for stateful apps with real operational logic like failover, backup and version upgrades.
57. How do you design a good CRD API?
Model what users want, not the implementation. Keep spec small and declarative, use sensible defaults, avoid exposing every child field, put observations in status with conditions, and follow the Kubernetes API conventions for naming and optional fields.
58. How do you handle long-running operations like backups?
Do not block reconcile. Start the work as a Job or an external call, record progress in status, and requeue to check. Model a backup as its own CR (for example Backup) so each run has its own status and history.
59. How do you manage external, non-Kubernetes resources?
Store an identifier for the external resource in status, make create calls idempotent (look up before creating), use a finalizer for cleanup, and requeue periodically to detect drift, since external systems do not send watch events.
60. How do you upgrade the application an Operator manages?
Let users set a version in spec, and implement upgrade steps in order: preflight checks, backup, rolling update, health checks, and a status condition showing progress. Refuse unsupported version jumps with clear status messages.
61. How do you upgrade the Operator itself safely?
Keep the CRD API backward compatible, serve old versions until stored objects are migrated, test the upgrade path from each supported previous version, and use OLM channels so clusters move through versions in order.
62. How do you migrate stored objects to a new CRD storage version?
Change the storage version, then rewrite existing objects so they are stored in the new version (a no-op update of each object does this), and only then remove the old version from status.storedVersions and stop serving it.
63. How do you reduce API server load from a large Operator?
Watch only needed namespaces and types, use label selectors and field indexers on the cache, avoid listing all objects every reconcile, use predicates to filter out irrelevant events such as status-only updates, and set sensible requeue intervals.
64. What are predicates?
Predicates filter events before they enter the work queue. GenerationChangedPredicate, for example, ignores updates that change only metadata or status, which avoids reconcile loops triggered by the controller's own status writes.
65. How do you avoid a hot reconcile loop?
Do not update objects unless something changed, compare before writing, filter events with predicates, and avoid writing timestamps to status every reconcile. Watch the reconcile rate metric to spot loops.
66. How do you secure an Operator?
Run with least-privilege RBAC, scope to namespaces where possible, use a restricted Pod Security Standard for the controller pod, avoid storing secrets in CR spec (reference Secrets instead), and sign and scan the Operator image.
67. How do you handle multi-tenancy?
Prefer namespaced CRs so tenants manage their own instances under namespace RBAC. Keep cluster-scoped configuration admin-only, and validate that a CR cannot reference Secrets or resources in other namespaces.
68. What is the difference between Operator SDK and Kubebuilder today?
For Go projects the layout and libraries are the same. Operator SDK adds Ansible and Helm operator types, OLM integration (bundle generation, run bundle) and scorecard. Kubebuilder focuses on Go controllers and APIs.
69. How would you explain the five capability levels to a product manager?
Level 1 installs the app. Level 2 upgrades it. Level 3 handles backup, restore and failure recovery. Level 4 exposes metrics, alerts and logs. Level 5 tunes and scales itself. Each level needs more code and testing.
Scenario-based Kubernetes Operator questions
70. A CR is stuck in Terminating. What do you check?
A finalizer is not being removed. Check whether the Operator is running and its logs for cleanup errors. If the Operator was uninstalled first, the finalizer will never clear; fix the cause, and only as a last resort remove the finalizer manually, knowing external resources may leak.
71. The controller reconciles the same object constantly.
Usually the controller updates the object (often status or an annotation) on every pass, which triggers another event. Compare before writing, use GenerationChangedPredicate for the primary type, and check for fields the API server defaults that your code keeps resetting.
72. A user changed the Deployment the Operator created, and the change keeps reverting.
That is expected: the Operator owns the Deployment and reconciles it back to what the CR says. Tell the user to change the CR. If some fields should be user-managed, have the Operator use server-side apply and stop managing them.
73. The Operator logs "forbidden" errors after an upgrade.
The new version needs permissions the old RBAC did not grant. Check the RBAC markers and regenerated manifests, or the CSV permissions if installed through OLM, and confirm the ServiceAccount binding.
74. kubectl apply of a CR fails with a schema error.
The CR does not match the CRD's OpenAPI schema, or the CRD on the cluster is older than the CR. Read the error, run kubectl explain, and check that the CRD version served matches what the manifest uses.
75. Two Operator replicas are both making changes.
Leader election is off or misconfigured. Enable it in the Manager options with a unique lease name and confirm only one replica holds the Lease (kubectl get lease -n operator-ns).
76. Status on the CR shows Ready but the app is down.
Status is computed from the wrong signal or not refreshed. Base Ready on real health (pod readiness, an application health check), set observedGeneration, and requeue periodically so status tracks changes that do not generate watch events.
How to prepare
Build a small Go Operator end to end: CRD with validation, reconcile that creates a Deployment and Service, status conditions, a finalizer, and envtest tests. Then install a community Operator through OLM and read its CSV. That covers most of what interviewers ask.
For other angles in this group, see the Kubernetes Operators engineer questions, the Operators FAQs and the Operator interview preparation guide. Core Kubernetes rounds use the 150+ advanced Kubernetes questions and Helm interview questions. Our DevOps interview questions hub links every topic.
To build the Kubernetes base Operators depend on, see our CKA training or CKAD training, in Kharadi, Pune or live online.
FAQ
What is a Kubernetes Operator in simple terms?
It is a custom controller plus a custom resource that automates running one application on Kubernetes, such as installing, upgrading, backing up and recovering it, the way an experienced operator would.
What is the difference between Operator SDK and Kubebuilder?
Both scaffold Go Operators with controller-runtime and the same layout. Operator SDK adds Ansible and Helm Operators, OLM bundle tooling and scorecard tests.
What is a finalizer in a Kubernetes Operator?
A finalizer is a metadata entry that blocks deletion of an object until the controller removes it, giving the Operator time to clean up external resources first.
Why should reconcile be idempotent?
Reconcile can run repeatedly for the same state after restarts, retries or resyncs. It must produce the same result each time without duplicating resources or repeating destructive actions.
What are the Operator capability levels?
Basic Install, Seamless Upgrades, Full Lifecycle, Deep Insights and Auto Pilot. They describe how much operational work an Operator automates.
What does OLM do?
The Operator Lifecycle Manager installs Operators from catalogs, manages their dependencies and permissions, and upgrades them according to the channel you subscribe to.
Should I write my own Operator or use an existing one?
Check OperatorHub.io and project documentation first. Write your own only when the application needs operational logic no existing Operator or Helm chart provides.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0