A CRD (Custom Resource Definition) adds an object type to the Kubernetes API, and a custom resource is an object of that type, which you handle with kubectl like a Pod. When a team installs an operator, you meet it in this form: a Sauvegarde or Certificate type, which you list, describe, modify and delete like everything else.
In this lesson you write a CRD, you discover those of a cluster, you create and modify a custom resource, you read the refusals of its schema, then you troubleshoot the three failures that a developer meets: no matches for kind, a resource stuck in Terminating and a permissions refusal. The lesson ends with a lab, then with the module's challenge.
What you will learn
- List the CRDs of a cluster, explore them with
kubectl explainand find their API group. - Create, inspect, modify and delete a custom resource with
kubectl, and read itsstatusfield. - Tell the refusals of a CRD schema apart (missing field, out-of-range value, wrong type, unknown field) and read the API message.
- Diagnose
no matches for kind, a resource stuck inTerminatingand a permissions problem. - Know what becomes of a resource when its CRD is deleted, and what to check before installing an operator.
- Pass the module's challenge without guidance: choose and deploy the right workload type for three needs.
Prerequisites
This lesson follows Kubernetes operators, which explains what an operator is and why a CRD alone does nothing. You also need a kind cluster (0.33.0) running Kubernetes v1.37.0, for example the one from the previous lesson. A single node is enough: the lesson only creates the ws-crd namespace and one CRD. The notions of permissions (ServiceAccount, Role, RoleBinding) are defined in the troubleshooting section, where they are needed. To go deeper, see RBAC and service accounts.
Prepare the namespace
Create a namespace and a working folder for the lesson.
mkdir -p ~/atelier-k8s/workloads/crd && cd ~/atelier-k8s/workloads/crdkubectl create namespace ws-crdnamespace/ws-crd createdThe names and messages of this lesson are in French on purpose, so that the outputs stay those of the tested cluster: atelier means "workshop", formation "training", Sauvegarde and sauvegardes "backup" and "backups", sauv is the short name of sauvegarde, nuit "night", donnees-boutique "shop-data", donnees "data", retentionJours "retentionDays", sans-source "no-source", hors-bornes "out-of-bounds", mauvais-type "wrong-type", trente "thirty", champ-inconnu "unknown-field", frequence "frequency", quotidienne "daily", version-deux "version-two", bloquee "stuck", nettoyage "cleanup", ws-crd-bloque "ws-crd-stuck", gestion-sauvegardes "backup-management" and dev-sauvegardes "dev-backups". The phases Terminee and Echec mean "Finished" and "Failure".
What happens when the CRD is not installed?
A classic mistake with custom resources is to apply an object whose CRD does not exist yet. Here is the object you will use throughout the lesson.
cat > sauvegarde-nuit.yaml <<'EOF'apiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: name: nuit namespace: ws-crdspec: source: donnees-boutique retentionJours: 30EOFkubectl apply -f sauvegarde-nuit.yamlError from server (NotFound): error when creating "sauvegarde-nuit.yaml": the server could not find the requested resource (post sauvegardes.atelier.formation.k8s)This message may not be the one you expected (no matches for kind). kubectl keeps on disk, in ~/.kube/cache/discovery, the list of object types that the API serves: this is its discovery cache, kept for six hours at most. If this cluster served the Sauvegarde type shortly before (a CRD created then deleted in the last six hours), kubectl believes the type is still there, sends the request, and it is the server that answers NotFound. A kubectl api-resources refreshes this cache. If you already get no matches for kind, your cache was up to date: go straight to the next message.
kubectl api-resources --api-group=atelier.formation.k8sNAME SHORTNAMES APIVERSION NAMESPACED KINDOnly the header is displayed: no type exists in this group. Now replay the apply, with a fresh cache.
kubectl apply -f sauvegarde-nuit.yamlerror: resource mapping not found for name: "nuit" namespace: "ws-crd" from "sauvegarde-nuit.yaml": no matches for kind "Sauvegarde" in version "atelier.formation.k8s/v1"ensure CRDs are installed firstThis time, the message starts with error: (an error detected by kubectl itself) and not with Error from server. It is the one you will see on a cluster whose cache is up to date. It says that kubectl cannot find the type: the CRD is missing, or its name or version is wrong. Both texts have the same cause, and the state of the cache only decides which one you see.
Write and install a CRD
The CRD declares the API group (atelier.formation.k8s), the name of the type (Sauvegarde) and a schema: the list of allowed fields, their type and their bounds. The source field is required, retentionJours must be an integer between 1 and 365. The subresources: status: {} section enables the status subresource, which is written separately from the rest of the object, and additionalPrinterColumns chooses the columns of kubectl get.
cat > crd-sauvegarde.yaml <<'EOF'apiVersion: apiextensions.k8s.io/v1kind: CustomResourceDefinitionmetadata: name: sauvegardes.atelier.formation.k8sspec: group: atelier.formation.k8s scope: Namespaced names: plural: sauvegardes singular: sauvegarde kind: Sauvegarde shortNames: - sauv versions: - name: v1 served: true storage: true subresources: status: {} additionalPrinterColumns: - name: Source type: string jsonPath: .spec.source - name: Retention type: integer jsonPath: .spec.retentionJours - name: Phase type: string jsonPath: .status.phase schema: openAPIV3Schema: type: object properties: spec: type: object required: - source properties: source: type: string description: The volume to back up retentionJours: type: integer minimum: 1 maximum: 365 description: Retention period in days status: type: object properties: phase: type: stringEOFkubectl apply -f crd-sauvegarde.yaml && kubectl wait --for=condition=Established crd/sauvegardes.atelier.formation.k8s --timeout=60scustomresourcedefinition.apiextensions.k8s.io/sauvegardes.atelier.formation.k8s createdcustomresourcedefinition.apiextensions.k8s.io/sauvegardes.atelier.formation.k8s condition metThe CRD is created, then Established: the API can serve the type. Always wait for this condition before creating an object of the new type.
Discover the CRDs of a cluster
On a cluster you do not know, three commands tell you which extra types exist: kubectl get crd lists the CRDs, kubectl api-resources the types served by a group, and kubectl api-versions the API versions. The lesson kubectl api-resources and explain already showed the first two; what is new here is what get crd adds: the short name, the scope and the storage version.
kubectl get crdkubectl api-resources --api-group=atelier.formation.k8skubectl api-versions | grep atelierNAME SCOPE VERSIONS CREATED ATsauvegardes.atelier.formation.k8s Namespaced v1(storage) 2026-11-12T00:03:28ZNAME SHORTNAMES APIVERSION NAMESPACED KINDsauvegardes sauv atelier.formation.k8s/v1 true Sauvegardeatelier.formation.k8s/v1The CRD has a name of the form <plural>.<group>. SCOPE Namespaced says that the object lives in a namespace, v1(storage) that v1 is the version in which the API stores the objects, and SHORTNAMES gives the sauv abbreviation. The group and the version, here atelier.formation.k8s/v1, form the apiVersion to write in your manifests. To learn the fields of a type, kubectl explain works as for a native object, as you saw in the lesson mentioned above, which applies it to a CRD of the same group.
kubectl explain sauvegarde.specGROUP: atelier.formation.k8sKIND: SauvegardeVERSION: v1
FIELD: spec <Object>
DESCRIPTION: <empty>FIELDS: retentionJours <integer> Retention period in days
source <string> -required- The volume to back upThe command goes down into spec and repeats the descriptions written in the CRD, with the -required- mark for source. This is how you find the fields of an operator whose documentation you do not have at hand.
Create, read, modify and delete a custom resource
A custom resource is created with kubectl apply, like a Deployment. Create nuit and list it.
kubectl apply -f sauvegarde-nuit.yaml && kubectl -n ws-crd get sauvegardessauvegarde.atelier.formation.k8s/nuit createdNAME SOURCE RETENTION PHASEnuit donnees-boutique 30The columns come from additionalPrinterColumns. PHASE is empty: the status field is written only by a controller, and there is none here. Read the whole object.
kubectl -n ws-crd get sauv nuit -o yamlapiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"atelier.formation.k8s/v1","kind":"Sauvegarde","metadata":{"annotations":{},"name":"nuit","namespace":"ws-crd"},"spec":{"retentionJours":30,"source":"donnees-boutique"}} creationTimestamp: "2026-11-12T00:03:31Z" generation: 1 name: nuit namespace: ws-crd resourceVersion: "5989" uid: 82e24600-924c-4d87-900c-b3be64be7acbspec: retentionJours: 30 source: donnees-boutiqueThe short name sauv works, because the CRD declares it. The spec is as you wrote it, and there is no status. To read the state of a resource managed by an operator, you will look for status at this spot.
Since the CRD enables the status subresource, the status is written separately from the rest of the object. Simulate what a controller would do with --subresource=status.
kubectl -n ws-crd patch sauvegarde nuit --subresource=status --type merge -p '{"status":{"phase":"Terminee"}}' && kubectl -n ws-crd get sauvegardessauvegarde.atelier.formation.k8s/nuit patchedNAME SOURCE RETENTION PHASEnuit donnees-boutique 30 TermineeThe PHASE column shows Terminee. Reapply the original file: it does not overwrite the status. A patch that targets the status without --subresource=status is, for its part, ignored without an error.
kubectl apply -f sauvegarde-nuit.yaml && kubectl -n ws-crd get sauvegardeskubectl -n ws-crd patch sauvegarde nuit --type merge -p '{"status":{"phase":"Echec"}}' && kubectl -n ws-crd get sauvegardessauvegarde.atelier.formation.k8s/nuit unchangedNAME SOURCE RETENTION PHASEnuit donnees-boutique 30 Termineesauvegarde.atelier.formation.k8s/nuit patched (no change)NAME SOURCE RETENTION PHASEnuit donnees-boutique 30 TermineeThe first apply returns unchanged and the status stays Terminee. The patch without a subresource returns patched (no change): the tool announces a success, but nothing has changed. Remember this trap: the status of a CRD that declares the subresource is only modified with --subresource=status. Finally, modify the spec.
kubectl -n ws-crd patch sauvegarde nuit --type merge -p '{"spec":{"retentionJours":60}}' && kubectl -n ws-crd get sauvegardeskubectl -n ws-crd delete sauvegarde nuitsauvegarde.atelier.formation.k8s/nuit patchedNAME SOURCE RETENTION PHASEnuit donnees-boutique 60 Termineesauvegarde.atelier.formation.k8s "nuit" deleted from ws-crd namespaceThe retention goes to 60, then the resource is deleted right away. kubectl edit makes the same modification by opening the object in an editor, but it is interactive.
Read the schema refusals
The CRD schema is enforced by the API: an object that does not follow it is refused, with a message that says why. Create four files, each with a different defect.
cat > sauvegarde-sans-source.yaml <<'EOF'apiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: name: sans-source namespace: ws-crdspec: retentionJours: 30EOFcat > sauvegarde-hors-bornes.yaml <<'EOF'apiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: name: hors-bornes namespace: ws-crdspec: source: donnees retentionJours: 400EOFcat > sauvegarde-mauvais-type.yaml <<'EOF'apiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: name: mauvais-type namespace: ws-crdspec: source: donnees retentionJours: "trente"EOFcat > sauvegarde-champ-inconnu.yaml <<'EOF'apiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: name: champ-inconnu namespace: ws-crdspec: source: donnees frequence: quotidienneEOFkubectl apply -f sauvegarde-sans-source.yamlkubectl apply -f sauvegarde-hors-bornes.yamlkubectl apply -f sauvegarde-mauvais-type.yamlkubectl apply -f sauvegarde-champ-inconnu.yamlThe Sauvegarde "sans-source" is invalid: spec.source: Required valueThe Sauvegarde "hors-bornes" is invalid: spec.retentionJours: Invalid value: 400: spec.retentionJours in body should be less than or equal to 365The Sauvegarde "mauvais-type" is invalid: spec.retentionJours: Invalid value: "string": spec.retentionJours in body must be of type integer: "string"Error from server (BadRequest): error when creating "sauvegarde-champ-inconnu.yaml": Sauvegarde in version "v1" cannot be handled as a Sauvegarde: strict decoding error: unknown field "spec.frequence"The four refusals, in order: missing required field (Required value), out-of-range value (should be less than or equal to 365), wrong type (must be of type integer, which quotes the received type "string", not the value trente) and unknown field. The last one has another form: BadRequest and strict decoding error, instead of is invalid. Each message quotes the path of the faulty field, for example spec.retentionJours, which you find again in kubectl explain.
The refusal of the unknown field comes from the validation that kubectl asks the server for. With --validate=false, the object is created, and the unknown field is silently removed.
kubectl apply -f sauvegarde-champ-inconnu.yaml --validate=falsekubectl -n ws-crd get sauvegarde champ-inconnu -o jsonpath='{.spec}{"\n"}'sauvegarde.atelier.formation.k8s/champ-inconnu created{"source":"donnees"}The resource is created without a warning, and frequence has disappeared: the server prunes the fields that the schema does not know. Do not use --validate=false to push a manifest through. To check a manifest without writing anything in the cluster, use --dry-run=server: the API applies the schema, with the same refusal as at creation.
kubectl apply -f sauvegarde-hors-bornes.yaml --dry-run=serverkubectl -n ws-crd get sauvegardesThe Sauvegarde "hors-bornes" is invalid: spec.retentionJours: Invalid value: 400: spec.retentionJours in body should be less than or equal to 365NAME SOURCE RETENTION PHASEchamp-inconnu donneesThe refusal is word for word identical to the one at creation. The list is not empty: champ-inconnu, created with --validate=false, is still there, and hors-bornes does not exist. Finally, ask for an API version that the CRD does not serve.
cat > sauvegarde-v2.yaml <<'EOF'apiVersion: atelier.formation.k8s/v2kind: Sauvegardemetadata: name: version-deux namespace: ws-crdspec: source: donneesEOFkubectl apply -f sauvegarde-v2.yamlerror: resource mapping not found for name: "version-deux" namespace: "ws-crd" from "sauvegarde-v2.yaml": no matches for kind "Sauvegarde" in version "atelier.formation.k8s/v2"ensure CRDs are installed firstThe text is the same as for a missing type, only the quoted version changes: no matches for kind therefore also signals a wrong API version. Compare the manifest's version with the APIVERSION column of kubectl api-resources.
Unblock a resource stuck in Terminating
A finalizer is a mark that the controller puts on an object to delay its deletion. If the controller does not remove it, the object stays. Create a resource that carries a finalizer, delete it, and read its state.
cat > sauvegarde-finalizer.yaml <<'EOF'apiVersion: atelier.formation.k8s/v1kind: Sauvegardemetadata: name: bloquee namespace: ws-crd finalizers: - atelier.formation.k8s/nettoyagespec: source: donneesEOFkubectl apply -f sauvegarde-finalizer.yaml && kubectl -n ws-crd delete sauvegarde bloquee --wait=false && kubectl -n ws-crd get sauvegarde bloquee -o jsonpath='{.metadata.deletionTimestamp}{"\n"}{.metadata.finalizers}{"\n"}'kubectl -n ws-crd get sauvegardessauvegarde.atelier.formation.k8s/bloquee createdsauvegarde.atelier.formation.k8s "bloquee" deleted from ws-crd namespace2026-11-12T00:03:32Z["atelier.formation.k8s/nettoyage"]NAME SOURCE RETENTION PHASEbloquee donneeschamp-inconnu donneeskubectl delete returned, but the object still exists: it carries a deletionTimestamp (the deletion request) and its finalizer. A custom resource has no STATUS column: the get line does not display Terminating, it is identical to that of a normal object. Only the deletionTimestamp gives away the blockage. Remove the finalizer with a JSON patch.
kubectl -n ws-crd patch sauvegarde bloquee --type=json -p='[{"op":"remove","path":"/metadata/finalizers"}]' && kubectl -n ws-crd get sauvegardessauvegarde.atelier.formation.k8s/bloquee patchedNAME SOURCE RETENTION PHASEchamp-inconnu donneesThe resource disappears as soon as the finalizer is removed. A finalizer exists for a cleanup that the controller must do: removing it without that cleanup having taken place can leave orphan resources behind. First check that the controller is not simply stopped.
The same blockage can hit a namespace: it is not deleted as long as it contains a resource with a finalizer.
kubectl create namespace ws-crd-bloque && sed 's/namespace: ws-crd$/namespace: ws-crd-bloque/' sauvegarde-finalizer.yaml | kubectl apply -f - && kubectl delete namespace ws-crd-bloque --wait=false && sleep 10 && kubectl get namespace ws-crd-bloque && kubectl get namespace ws-crd-bloque -o jsonpath='{.status.conditions}{"\n"}'namespace/ws-crd-bloque createdsauvegarde.atelier.formation.k8s/bloquee creatednamespace "ws-crd-bloque" deletedNAME STATUS AGEws-crd-bloque Terminating 10s[{"lastTransitionTime":"2026-11-12T00:03:37Z","message":"All resources successfully discovered","reason":"ResourcesDiscovered","status":"False","type":"NamespaceDeletionDiscoveryFailure"},{"lastTransitionTime":"2026-11-12T00:03:37Z","message":"All legacy kube types successfully parsed","reason":"ParsedGroupVersions","status":"False","type":"NamespaceDeletionGroupVersionParsingFailure"},{"lastTransitionTime":"2026-11-12T00:03:37Z","message":"All content successfully deleted, may be waiting on finalization","reason":"ContentDeleted","status":"False","type":"NamespaceDeletionContentFailure"},{"lastTransitionTime":"2026-11-12T00:03:37Z","message":"Some resources are remaining: sauvegardes.atelier.formation.k8s has 1 resource instances","reason":"SomeResourcesRemain","status":"True","type":"NamespaceContentRemaining"},{"lastTransitionTime":"2026-11-12T00:03:37Z","message":"Some content in the namespace has finalizers remaining: atelier.formation.k8s/nettoyage in 1 resource instances","reason":"SomeFinalizersRemain","status":"True","type":"NamespaceFinalizersRemaining"}]The namespace stays Terminating after 10 seconds. Read the conditions whose status is True: NamespaceContentRemaining (sauvegardes.atelier.formation.k8s has 1 resource instances) and NamespaceFinalizersRemaining (atelier.formation.k8s/nettoyage in 1 resource instances). They say which type and which finalizer hold the namespace, which saves you from searching blindly. Remove the finalizer of the resource concerned.
kubectl -n ws-crd-bloque patch sauvegarde bloquee --type=json -p='[{"op":"remove","path":"/metadata/finalizers"}]' && sleep 10 && kubectl get namespace ws-crd-bloquesauvegarde.atelier.formation.k8s/bloquee patchedError from server (NotFound): namespaces "ws-crd-bloque" not foundTen seconds after the removal, the namespace no longer exists: the NotFound is the expected result, the proof that the blockage is lifted.
Diagnose a permissions problem
A custom resource is protected by RBAC (Kubernetes access control) like a native object, with the API group of the CRD. Three objects come into play. A ServiceAccount is the identity of a program that talks to the API; it has no permission at the start. A Role is a list of permissions in a namespace: which verbs (get, list, create…) on which resources. A RoleBinding gives this Role to an identity. The --as option of kubectl runs a command while impersonating an identity, and kubectl auth can-i answers yes or no to the question "does this identity have this permission?". Create a dev service account and try to list the backups on its behalf.
kubectl -n ws-crd create serviceaccount devkubectl -n ws-crd get sauvegardes --as=system:serviceaccount:ws-crd:devkubectl auth can-i create sauvegardes.atelier.formation.k8s -n ws-crd --as=system:serviceaccount:ws-crd:devserviceaccount/dev createdError from server (Forbidden): sauvegardes.atelier.formation.k8s is forbidden: User "system:serviceaccount:ws-crd:dev" cannot list resource "sauvegardes" in API group "atelier.formation.k8s" in the namespace "ws-crd"noThe Forbidden message gives everything needed to write the rule: the verb (list), the resource (sauvegardes), the API group (atelier.formation.k8s) and the namespace. kubectl auth can-i answers no and exits with code 1 on a refusal. Create a role limited to these three verbs and bind it to the account.
kubectl -n ws-crd create role gestion-sauvegardes --verb=get,list,create --resource=sauvegardes.atelier.formation.k8s && kubectl -n ws-crd create rolebinding dev-sauvegardes --role=gestion-sauvegardes --serviceaccount=ws-crd:devkubectl -n ws-crd get sauvegardes --as=system:serviceaccount:ws-crd:dev && kubectl auth can-i delete sauvegardes.atelier.formation.k8s -n ws-crd --as=system:serviceaccount:ws-crd:devrole.rbac.authorization.k8s.io/gestion-sauvegardes createdrolebinding.rbac.authorization.k8s.io/dev-sauvegardes createdNAME SOURCE RETENTION PHASEchamp-inconnu donneesnoThe list is now read without an error, with champ-inconnu still there. can-i delete answers no: the role gives neither delete nor update, and permissions are granted verb by verb. This reasoning also applies to the operator itself: an operator whose logs repeat forbidden has an incomplete Role (or its cluster-wide equivalent, the ClusterRole), and the custom resource can be accepted by the API with nothing happening.
What happens to a resource when its CRD is deleted?
Deleting a CRD deletes all the objects of that type, in all namespaces. Recreate nuit, then delete the CRD.
kubectl apply -f sauvegarde-nuit.yaml && kubectl delete crd sauvegardes.atelier.formation.k8s && kubectl -n ws-crd get sauvegardessauvegarde.atelier.formation.k8s/nuit createdcustomresourcedefinition.apiextensions.k8s.io "sauvegardes.atelier.formation.k8s" deletedError from server (NotFound): Unable to list "atelier.formation.k8s/v1, Resource=sauvegardes": the server could not find the requested resource (get sauvegardes.atelier.formation.k8s)The CRD left with its objects: no backup exists anymore. The final message is once again the one from the discovery cache of kubectl, which still knows the type. After a kubectl api-resources, the same get gives error: the server doesn't have a resource type "sauvegardes", the text that kubectl writes when its cache is up to date. Before deleting a CRD, list its objects: the deletion is final, with no confirmation.
Install an operator
You do not need to write your own operator to use a custom resource: this lesson used none, and the API still stored and validated your objects. An operator adds the controller that acts on them, and the lesson Kubernetes operators installed one, MongoDB Controllers for Kubernetes, with kubectl apply of its manifests. A Helm (in French) chart brings the CRDs, the controller and its permissions in the same way. Judge an operator before installing it with the method of the previous lesson: compatibility matrix, project activity, requested permissions, license, uninstallation. The CRDs of common operators are found in the guide of each tool, such as cert-manager.
Clean up the cluster
Delete the namespace, which takes the service account, the role and its binding with it, then the CRD if it still exists, and check the state.
kubectl delete namespace ws-crd --wait=true --timeout=120skubectl delete crd sauvegardes.atelier.formation.k8s --ignore-not-foundkubectl get crd,namespacenamespace "ws-crd" deletedNAME STATUS AGEnamespace/default Active 25mnamespace/kube-node-lease Active 25mnamespace/kube-public Active 25mnamespace/kube-system Active 25mnamespace/local-path-storage Active 25mThe CRD no longer existed: --ignore-not-found prints nothing. No CRD and no namespace of the lesson remain. The module's challenge creates its own kind cluster, named multi, in a virtual machine: you can therefore delete your working cluster with kind delete cluster --name <cluster-name>, or keep it for your own experiments.
Put it into practice
A guided lab of about 25 minutes repeats these actions on another CRD. In Use a custom resource, read its schema refusals, unblock it, a backup CRD is already installed, without an operator, with two resources of which one stays in Terminating. You create a backup, you modify one without recreating it, you note the API group and version, you read the message of a schema refusal, then you unblock the resource without deleting the CRD or the other resources.
Challenge: choose and deploy the right workload for three needs
The challenge is the module's proof without help: it describes three needs without naming an object type, and it is graded on the cluster state you leave behind, not on the commands you typed. It is up to you to choose the right workload for each need: a database whose replicas keep their identity and their data, an agent present on every node, control plane included, and a custom resource whose schema carries a bound. It builds on this lesson, on StatefulSets, on DaemonSets and on Kubernetes operators.
The specification has seven requirements of equal weight, each checked by a test, and passing takes 70 points out of 100. Three requirements are blocking: they must succeed whatever the total. No hint is offered: you have only the specification and what the module taught you. Each requirement is worth about 14 points, so five requirements met at least, blocking ones included, reach the threshold.
Key takeaways
- A CRD adds an object type to the API; wait for its
Establishedcondition before creating objects. The group and the version are read withkubectl api-resourcesandkubectl api-versions. kubectl explain <type>.specgives the fields of a custom resource, with-required-for the required ones.- The
statusof a CRD that declares the subresource is only written with--subresource=status: without it, a patch returnspatched (no change)and changes nothing. - The schema refuses a missing field, an out-of-range value and a wrong type with
is invalid; an unknown field givesBadRequestandstrict decoding error.--dry-run=servergives the same refusal without creating anything. no matches for kindpoints to a type or an API version thatkubectlcannot find; depending on its discovery cache,kubectldisplaysNotFound ... could not find the requested resourceinstead.kubectl api-resourcesrefreshes the cache.- A stuck custom resource does not show its blockage in
get: read.metadata.deletionTimestampand.metadata.finalizers, then remove the finalizer with a JSON patch once you are sure the controller has no cleanup left to do. - A namespace stuck in
Terminatingsays why in.status.conditions:NamespaceContentRemainingandNamespaceFinalizersRemainingname the type and the finalizer. - A
Forbiddengives the verb, the resource, the API group and the namespace needed for the RBAC rule; deleting a CRD deletes all its objects, with no confirmation.
Test your knowledge
This quiz covers the discovery of CRDs, the schema refusals, the status field and the diagnosis of the three failures of the lesson. Allow five minutes and aim for 80%; below that, reread "Read the schema refusals".
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: Level 2 exam: deploy an application
A new full quiz with random questions
Work again only on the questions you missed