logo

Kubernetes - CRDs

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
spec:
  # group name to use for REST API: /apis/<group>/<version>
  group: stable.example.com
  ...

Apply CRD so the new resource can be recognized by k8s:

$ kubectl apply -f crd.yaml

Then create custom objects also by kubectl apply:

$ kubectl apply -f foo.yaml

On their own, custom resources let you store and retrieve structured data. When you combine a custom resource with a custom controller, custom resources provide a true declarative API.

CustomResourceDefinition (CRD): to extend the Kubernetes API.

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition

ConfigMap

apiVersion: v1
kind: ConfigMap

to store non-confidential data in key-value pairs.

Unlike most Kubernetes objects that have a spec, a ConfigMap has data and binaryData fields.