WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Kubernetes · Intermediate · question 39 of 100

Discuss the role of Kubernetes Custom Resource Definitions (CRDs).?

📕 Buy this interview preparation book: 100 Kubernetes questions & answers — PDF + EPUB for $5

Kubernetes Custom Resource Definitions (CRDs) allow users to define and use their custom resources within a Kubernetes cluster. They provide a way to extend the Kubernetes API to support new types of resources beyond the built-in types such as Pods, Services, and Deployments. CRDs are a powerful feature that enables users to define their own application-specific objects in Kubernetes and use them just like any other Kubernetes resource.

To define a CRD, you create a custom resource definition object in Kubernetes. This object contains a description of the new resource type, including its name, version, and schema. The schema defines the structure of the resource and the allowed fields, as well as any default values and validation rules.

Here’s an example of a CRD that defines a custom resource called "Foo" with two fields: "name" and "size":

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: foos.example.com
spec:
  group: example.com
  version: v1alpha1
  scope: Namespaced
  names:
    plural: foos
    singular: foo
    kind: Foo
  validation:
    openAPIV3Schema:
      type: object
      properties:
        name:
          type: string
        size:
          type: integer

Once you have defined a CRD, you can create instances of the new resource type in the same way as other Kubernetes resources. For example, to create an instance of the "Foo" resource defined above, you would use a YAML manifest like this:

apiVersion: example.com/v1alpha1
kind: Foo
metadata:
  name: my-foo
spec:
  name: bar
  size: 42

CRDs are useful in a variety of scenarios, such as when you need to define custom resources to manage stateful applications or specialized hardware resources. They provide a simple and consistent way to extend Kubernetes to support new types of resources and enable users to easily manage their applications and infrastructure.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Kubernetes interview — then scores it.
📞 Practice Kubernetes — free 15 min
📕 Buy this interview preparation book: 100 Kubernetes questions & answers — PDF + EPUB for $5

All 100 Kubernetes questions · All topics