Getting Started with Kubernetes | API Programming Paradigm

1. Source of Requirements

What is CRD used for?

2. Case Study

A CRD Case Study

  • The group field is set to
  • The version field is set to v1alpha1.
  • In the names part, the kind field is set to Foo, just as how “kind” is set to Deployment when a Deployment is created or set to Pod when a pod is created.
  • The plural field indicates the custom name of a field or a resource with a long name.
  • The scope field indicates whether the CRD is managed by a namespace. For example, ClusterRoleBinding is of the cluster level. Pods and Deployments can be created in different namespaces, so the scope field is set to Namespaced. Here, the scope field of the CRD is set to Namespaced.
  • apiVersion is set to
  • kind is set to Foo.
  • indicates the CRD name.
  • The spec field is not defined in the CRD schema and can be set in the key:value format, for example, deploymentName: example-foo or replicas:
  1. You can configure validation or a status resource to define the content of spec.

CRD with Validation

CRD with the Status Field

3. Practice

4. Architecture Design

Controller Overview

Controller Workflow Overview

  • ListFunc lists all existing resources, similar to kuberctl get pods.
  • WatchFunc establishes a persistent connection to the Kubernetes API server. When a new object is committed, the Kubernetes API server pushes it back to tell the informer that a new object was created or updated.

5. Summary

  • CRD is a type of custom resource, allowing you to scale up the native resources of Kubernetes as needed.
  • Like the native resources of Kubernetes, CRDs are subjected to RBAC and support the status field.
  • CRD controllers allow you to compile and parse CRDs and set the desired CRD status.

Original Source:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: