Custom resources definition

Creating a Custom Resources Definition (CRD) object includes two steps: CRD registration and object creation.

Let's create a CRD configuration first:

# cat chapter5/5-4_crd/5-4-1_crd.yamlapiVersion: apiextensions.k8s.io/v1beta1kind: CustomResourceDefinitionmetadata:  name: books.devops.kubernetes.comspec:  group: devops.kubernetes.com  version: v1alpha1  scope: Namespaced  names:    plural: books    singular: book    kind: Book    shortNames:    - bk  validation:    openAPIV3Schema:      required: ["spec"]      properties:        spec:          required: ["name", "edition"]          properties:            name:              type: string              minimum: 50            edition:              type: string              minimum: 10            chapter:              type: integer              minimum: 1              maximum: 2

With CustomResourceDefinition, we can define our own spec for the ...

Get DevOps with Kubernetes - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.