Kubernetes Container Orchestration Operators and Custom Resources 1 — Questions and Answers
Question 1: What is a Custom Resource Definition (CRD) in Kubernetes?
- A built-in Kubernetes resource type that ships with every cluster
- An extension mechanism that allows defining new resource types in the Kubernetes API (Correct answer)
- A type of Pod that runs custom application workloads
- A configuration file format used by Helm charts
Correct answer: An extension mechanism that allows defining new resource types in the Kubernetes API
CRDs extend the Kubernetes API by allowing users to define and manage their own custom resource types beyond the built-in ones.
Question 2: What is the primary purpose of a Kubernetes Operator?
- To operate and maintain the Kubernetes control plane components
- To automate the management of complex stateful applications using domain-specific knowledge (Correct answer)
- To deploy containers directly to worker nodes via the kubelet
- To configure network policies for inter-pod communication
Correct answer: To automate the management of complex stateful applications using domain-specific knowledge
Operators encode operational knowledge into software that automates the full lifecycle management of complex applications.
Question 3: Which API group is used for managing Custom Resource Definitions?
- apps/v1
- core/v1
- apiextensions.k8s.io/v1 (Correct answer)
- rbac.authorization.k8s.io/v1
Correct answer: apiextensions.k8s.io/v1
CRDs are managed through the apiextensions.k8s.io/v1 API group, which handles extensions to the Kubernetes API itself.
Question 4: What is a controller in the Kubernetes operator pattern?
- A user interface for managing and visualizing Kubernetes clusters
- A reconciliation loop that watches resources and takes actions to match desired state (Correct answer)
- A network controller that manages ingress traffic routing rules
- A storage controller that provisions and manages persistent volumes
Correct answer: A reconciliation loop that watches resources and takes actions to match desired state
Controllers implement a reconciliation loop that continuously watches resource state and takes actions to converge actual state with desired state.
Question 5: Which tool is the official framework for scaffolding and building Kubernetes Operators?
- kubectl
- kubeadm
- Operator SDK (Correct answer)
- kustomize
Correct answer: Operator SDK
The Operator SDK, part of the Operator Framework project, provides scaffolding, libraries, and tooling for building Kubernetes Operators.
Question 6: What scope options are available when defining a Custom Resource Definition?
- Operators scope and Controllers scope only
- Either Namespaced or Cluster scope (Correct answer)
- Always cluster-wide scope only
- Always namespace-scoped only
Correct answer: Either Namespaced or Cluster scope
CRDs can be scoped as Namespaced (instances live in a namespace) or Cluster (instances are cluster-wide resources).
Question 7: What is the purpose of OpenAPI v3 schema validation in a CRD?
- To authenticate users who access the custom resource via the API
- To define the schema and validate fields when custom resource instances are created or updated (Correct answer)
- To validate the health and connectivity of cluster nodes
- To check network connectivity between pods using the custom resource
Correct answer: To define the schema and validate fields when custom resource instances are created or updated
CRD OpenAPI v3 schema validation enforces the structure, types, and constraints on fields when custom resource instances are created or modified.
What is a Custom Resource Definition (CRD) in Kubernetes?