Start your terminal to use beginner mode.
Scenario
You need to extend the Kubernetes API to support a proprietary resource type called "Widget". By defining a CustomResourceDefinition (CRD), you allow users to manage these widgets using standard kubectl commands just like Pods or Services.
Task
Create a CustomResourceDefinition named widgets.mycompany.io. Define the group as mycompany.io and the kind as Widget short name wd and with served:true storage:true parameters. Specify the scope as Namespaced and define a version named v1. Create a Custom Resource instance of this type named sample-widget in the extensions namespace. Verify that the API accepts the new resource and that you can list it.
Example
Initial State (Before):
$ kubectl get widgets
error: the server doesn't have a resource type "widgets"
Success State (After):
# The API now recognizes the type
$ kubectl get crd widgets.mycompany.io
NAME CREATED AT
widgets.mycompany.io 2024-01-01T12:00:00Z
# The instance exists
$ kubectl get widgets -n extensions
NAME AGE
sample-widget 5s
Terminal requires a larger screen
Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.
Kubernetes Environment
Launch a live cluster to solve this challenge.
Track
| Question | Difficulty | Company | Access |
|---|
ActivisionBlizzard