Start your terminal to use beginner mode.
Scenario
You manage a CustomResourceDefinition (CRD) for "Widgets". Currently, the API allows users to create widgets with missing or invalid configuration, which causes the controller to crash. You need to enforce strict validation at the API level to reject bad data before it enters the cluster.
Task
Modify the existing widgets.mycompany.io CRD to enforce a schema. Require the field spec.size to be present. Restrict spec.size to be an integer with a minimum value of 1. Attempt to create a custom resource named bad-widget (provided in the file bad-widget.yaml) that is missing the size field. Verify that the creation fails and the resource is not created.
Example
Initial State (Loose Schema):
# The CRD accepts any random fields (or lack thereof)
$ kubectl explain widget.spec
<empty>
Success State (Strict Schema):
# The API rejects invalid data
$ kubectl apply -f bad-widget.yaml
The Widget "bad-widget" is invalid: spec.size: Required value
# The resource should NOT appear in the list
$ kubectl get widget bad-widget
Error from server (NotFound): widgets.mycompany.io "bad-widget" not found
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.
Slack
Accenture
Coinbase
Adobe
EPAM
Twitch
Amazon
Kayak
Autodesk
Lyft
Revolut
RedHat
Bloomberg
Datadog
Palantir
TCS
HashiCorp
Google
DeutscheBank
GitHub
Apple
Cloudflare
Stripe
Microsoft
NVIDIA
GoDaddy
X
SAP
Spotify
Airbnb
Meta
Reddit
Yelp
Okta
Dropbox
ActivisionBlizzard
Zscaler
Uber
IBM
DeliveryHero
Robinhood
GitLab
Shopify
Samsung
Elastic
Twilio
Netflix
CrowdStrike
Ubisoft
Anthropic
Capital One
Splunk
Intel
AMD
Databricks