Junior — Middle
Can you explain what CRD means in the context of Kubernetes?
sobes.tech AI
Answer from AI
CRD (Custom Resource Definition) in Kubernetes is a mechanism that allows you to create your own resources (objects) in the cluster, extending the standard Kubernetes API. With CRD, you can define a new resource type with specific fields and behaviors, to manage application-specific objects just like standard ones, such as Pod or Service.
Example of creating a CRD to add a new resource MyApp in the cluster:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: myapps.example.com
spec:
group: example.com
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
replicas:
type: integer
scope: Namespaced
names:
plural: myapps
singular: myapp
kind: MyApp
shortNames:
- ma
After creating this CRD, you can create objects of type MyApp and manage them via kubectl and Kubernetes API.