Kubernetes 101 : A simple overview of the CRD - Custom Resource Definition -
Extensions could be related for example to networking (CNI), storage (CSI) or container runtime engines (CRI).
Custom resources definition (CRD) are API objects, and can be accessed and manipulated like the kubernetes "standard" API objects using the "kubectl" tool.
The names of the CRD resource has to follow the below naming convention:
plural-name from the "plural" in the above Yaml file.
To create the CRD resource we use the below command:
Creating instances of the CRD resource:
To create instances of our CRD resources, we define a Yaml configuration file for it:
We can display our new resources using the below command:
The "testresource" API controller:
The new object needs be associated with its a API controller, to manage, monitor, create, delete, ..., the new resource.
We can either use a default controller with basic functionalities (simple loop that watches the new API object), or write our own controller.
A controller for our CRD, constantly watches the API server for instructions to create a "testresource".
It takes care of creating the deployment, the pods and the services - for accessing the "testresource" pods - .
It then, continuously watches the pods to make sure they are running as they should.
Comments