A Kubernetes operator extends the API to manage an application or service. Its Custom Resource Definitions (CRDs) establish the resource types and fields; its controller defines how to manage those resources, automating tasks such as deployment, scaling, and healing. The operator is more than a CRD alone. section 5.4
A CRD is the definition of a resource type; a custom resource (CR) is an object created from that definition. Create the CRD before creating its CRs. For example, an operator can define a Cluster resource type, then respond when you create a particular Cluster object. section 5.4.3
To install and inspect an operator:
- Apply its installation YAML with kubectl, or install it with Helm. The CloudNativePG installation YAML installs the operator and its CRDs; Helm installs CRDs by default unless --skip-crds is specified. section 5.4.2
- Run kubectl get crds to confirm the definitions are present. Use kubectl api-resources --api-group=postgresql.cnpg.io to find their API resources, and kubectl explain clusters.postgresql.cnpg.io to inspect the Cluster schema. section 5.4.2
- Check that the controller is running with kubectl get deployment -n cnpg-system cnpg-controller-manager. Installing resource definitions is not the same as creating a resource for the operator to manage. section 5.4.3
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: my-postgres-cluster
namespace: default
spec:
instances: 1
storage:
size: 1Gi
This Cluster CR requests one Postgres instance with 1Gi of storage in the default namespace. Its apiVersion and kind identify the operator-provided resource type. section 5.4.3
Save that manifest as postgres-cluster.yaml and run kubectl apply -f postgres-cluster.yaml. Then run kubectl get cluster my-postgres-cluster: the example reports one ready instance and a healthy cluster. kubectl describe cluster my-postgres-cluster shows more status detail, while kubectl get pods confirms the instance is running. This one-instance exercise verifies operation; it does not demonstrate a highly available configuration. section 5.4.3
For CKA preparation, practice the general workflow rather than memorizing a particular operator: install it, identify its CRDs, inspect the expected fields, create a CR, and verify the resulting state. The exam does not require knowledge of one specific operator. section 5.4 section 9.3.4






