A custom object, also called a custom resource (CR), is an instance of a resource type defined by a custom resource definition (CRD). It is the YAML or kubectl-managed object that an operator watches and reconciles. section 5.4.3 section 5.4
Use the distinction between the definition and its instances when working with custom objects:
- A CRD defines the schema, API group, version, kind, resource name, and scope. section 5.4.1
- A custom object instantiates that definition and supplies metadata plus desired state in its spec. section 5.4.3
- An operator observes the object and performs application-specific work such as deployment, scaling, or healing. section 5.4
Create and verify a PostgreSQL custom object
Apply a Cluster object with apiVersion postgresql.cnpg.io/v1, name my-postgres-cluster, namespace default, one instance, and 1Gi of storage. Verify it with kubectl get cluster my-postgres-cluster, kubectl describe cluster my-postgres-cluster, and kubectl get pods; the resulting status can report a healthy cluster and a Running PostgreSQL pod. section 5.4.3
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: my-postgres-cluster
namespace: default
spec:
instances: 1
storage:
size: 1Gi
Inspect the complete Cluster manifest to connect apiVersion, kind, metadata, namespace, and spec fields with the resulting custom object. section 5.4.3

