G/co/crd/setup [portable] -
kubectl get crd | grep databasebackups kubectl explain databasebackup You should see your new resource type available. Now that the CRD exists, create an instance of your custom resource ( my-backup.yaml ):
apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: databasebackups.stable.example.com spec: group: stable.example.com versions: - name: v1 served: true storage: true schema: openAPIV3Schema: type: object properties: spec: type: object properties: backupSchedule: type: string retentionDays: type: integer scope: Namespaced names: plural: databasebackups singular: databasebackup kind: DatabaseBackup shortNames: - dbb Use kubectl to apply your CRD: g/co/crd/setup
# Example: ./g/co/crd/setup.sh kubectl apply -f ./crds/ kubectl wait --for=condition=established --timeout=60s crd/databasebackups.stable.example.com echo "CRD setup complete." Check that your CRD was created successfully: kubectl get crd | grep databasebackups kubectl explain
apiVersion: stable.example.com/v1 kind: DatabaseBackup metadata: name: nightly-backup spec: backupSchedule: "0 2 * * *" retentionDays: 7 Apply it: g/co/crd/setup
kubectl apply -f my-resource-crd.yaml To follow the g/co/crd/setup pattern, you could wrap this in a script or Makefile: