Choose the best description of what a CRD does in a Kubernetes cluster.
Think about how Kubernetes can be extended to manage new types of objects.
A CRD lets you create your own resource types so Kubernetes can understand and manage them like built-in objects such as pods or services.
You run kubectl get crds after applying a CRD manifest named widgets.example.com. What will you see?
kubectl get crdsRemember that CRDs are cluster-wide resources, not namespace-scoped.
The kubectl get crds command lists all CRDs in the cluster with their names and creation timestamps.
Review this CRD YAML snippet and select the option that correctly identifies the error.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: gadgets.example.com
spec:
group: example.com
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
size:
type: integer
scope: Namespaced
names:
plural: gadgets
singular: gadget
kind: Gadget
listKind: GadgetListCheck the indentation and field names carefully under 'versions'.
The 'schema' field is correctly named 'schema.openAPIV3Schema' under 'versions'. The other options contain incorrect claims: 'scope' is case-sensitive and must be 'Namespaced' with uppercase N; 'metadata.name' is correct; 'subresources' is optional.
You apply a CRD manifest but get the error: error: unable to recognize "crd.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1". What is the cause?
Check the API version compatibility with your Kubernetes cluster version.
The 'apiextensions.k8s.io/v1beta1' API version for CRDs was removed in Kubernetes 1.22+. You must use 'apiextensions.k8s.io/v1' instead.
Put these steps in the correct order to successfully create and use a new Custom Resource Definition.
You must define and register the CRD before creating custom resources.
First, write the CRD manifest, then apply it to register the new resource type. After that, create instances of the custom resource and finally verify them.