Create your own CRD

CRD (Custom Resource Definition)

This defines how we want our custom Kubernetes objects to look and behave.

The name of the CRD must follow this format: .

Example: albertocrds.crds.albertogalvez.com

To list existing CRDs:

1
kubectl get crds

In the custom resource manifest, you must specify:

1
2
3
apiVersion: crds.albertogalvez.com/v1
kind: Albertocrds
...

Controller

Now we create our controller, which is simply an application running continuously in Kubernetes, listening for changes to our custom resources.

There are libraries available to build controllers in various programming languages.

In Python, for example, you can use the kopf library.

Example execution:

1
kopf run /path/to/controller.py