K8S Custom Resource

K8S Custom Resource

Tags
k8s
Engineering
Created
Oct 6, 2023 02:06 AM
Edited
Oct 5, 2023
Description
Custom resource is useful when you don’t want to use normal k8s resources

Custom Resource

  • A k8s resource is something like pods, containers, and etc, that you can interact with API; a k8s custom resource is to create any resource you want such as alvinPod, and then you can use k8s API to interact with it
Custom resources are extensions of the Kubernetes API.

Custom Resource Definition

  • To define custom resource
Defining a CRD object that creates a new custom resource with a name and schema that you specify. The Kubernetes API serves and handles the storage of your custom resource.

Custom Resource Controller

  • Custom resource controller is like the normal k8s controller that has the information of the desired state as well as k8s API
  • You can write custom code to do whatever you want using k8s API
    • Ex: this custom controller can control the lifecycle of alvinPod with ad-hoc business logic you write
You can use custom controllers to encode domain knowledge for specific applications into an extension of the Kubernetes API.

Resource