Kubernetes Container Orchestration Operators and Custom Resources 2 — Questions and Answers
Question 1: What is the role of a finalizer in Kubernetes custom resources?
- To finalize and mark the deployment of a resource as complete
- To ensure cleanup actions are performed before a resource is deleted (Correct answer)
- To trigger resource upgrades when a new version is available
- To mark a batch job resource as finished after processing
Correct answer: To ensure cleanup actions are performed before a resource is deleted
Finalizers are string keys on a resource's metadata that block deletion until a controller removes them after completing required cleanup actions.
Question 2: What does the observedGeneration field in a custom resource status indicate?
- The total number of replicas currently observed running
- The resource spec generation that the controller last successfully reconciled (Correct answer)
- The Kubernetes API server version currently being used
- The number of times the resource spec was updated by a user
Correct answer: The resource spec generation that the controller last successfully reconciled
The observedGeneration field tracks which spec generation the controller has last processed, allowing users to detect if the controller is in sync with the latest spec.
Question 3: Which type of admission webhook can modify objects before they are persisted in Kubernetes?
- Validating admission webhook
- Mutating admission webhook (Correct answer)
- Defaulting admission webhook
- Converting admission webhook
Correct answer: Mutating admission webhook
Mutating admission webhooks can modify resource objects — injecting fields, setting defaults, or adding sidecars — before they are stored in etcd.
Question 4: What is a conversion webhook used for in Custom Resource Definitions?
- Converting resource specifications from JSON to YAML format for storage
- Converting custom resource objects between different stored API versions as the CRD evolves (Correct answer)
- Converting namespaced custom resources to cluster-scoped resources
- Converting container-based workloads to VM-based workloads
Correct answer: Converting custom resource objects between different stored API versions as the CRD evolves
Conversion webhooks translate custom resource objects between API versions, enabling backward compatibility as the CRD schema evolves.
Question 5: In the Operator Capability Level model, what does Level 2 (Seamless Upgrades) mean?
- The operator can install the application on a fresh cluster
- The operator can manage and orchestrate application version upgrades (Correct answer)
- The operator provides full auto-pilot with no human intervention needed
- The operator uses level 2 TLS encryption for all communications
Correct answer: The operator can manage and orchestrate application version upgrades
Level 2 in the Operator Capability Levels means the operator can handle application upgrades seamlessly without manual steps.
Question 6: What is the purpose of enabling the status subresource in a CRD?
- To define the desired configuration state of the custom resource
- To allow updating status separately from spec without triggering unnecessary reconciliation (Correct answer)
- To expose the resource's status metrics to Prometheus for monitoring
- To store audit logs and change history for the custom resource
Correct answer: To allow updating status separately from spec without triggering unnecessary reconciliation
The status subresource separates status updates from spec updates so controllers can update status without triggering spec change reconciliation loops.
Question 7: What is the relationship between a CRD and a Custom Resource (CR)?
- They are the same Kubernetes object with different names
- A CRD defines the type schema; a CR is a specific instance created from that schema (Correct answer)
- A CR is a container for grouping multiple CRD definitions together
- CRDs are a deprecated predecessor to the newer CR specification format
Correct answer: A CRD defines the type schema; a CR is a specific instance created from that schema
A CRD acts as the type definition (like a class), while a Custom Resource is a specific instance created according to that definition.
What is the role of a finalizer in Kubernetes custom resources?