0
0
Kubernetesdevops~20 mins

Operator SDK basics in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Operator SDK Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Operator SDK: Initializing a new operator project
What is the output when you run operator-sdk init --domain=example.com --repo=github.com/example/memcached-operator in an empty directory?
ACreates a new operator project with Go modules initialized and a basic directory structure including API and controllers folders.
BThrows an error because the --repo flag is missing a version number.
CInitializes a Helm chart inside the directory instead of a Go operator project.
DOutputs a warning that the domain is invalid and aborts the initialization.
Attempts:
2 left
💡 Hint
The init command sets up the project structure and Go modules for a new operator.
🧠 Conceptual
intermediate
1:30remaining
Understanding Operator SDK project structure
Which folder in an Operator SDK Go project contains the Custom Resource Definitions (CRDs) and API types?
Acontrollers
Bapi
Cconfig
Dbuild
Attempts:
2 left
💡 Hint
Think about where you define the schema and types for your custom resources.
🔀 Workflow
advanced
2:00remaining
Operator SDK: Adding a new API version
You want to add a new version v2 to your existing API group memcached.example.com. Which command correctly adds this new version?
Aoperator-sdk generate api --group memcached --version v2 --kind Memcached
Boperator-sdk add api --group memcached --version v2 --kind Memcached
Coperator-sdk init --group memcached --version v2 --kind Memcached
Doperator-sdk create api --group memcached --version v2 --kind Memcached --resource --controller
Attempts:
2 left
💡 Hint
Use the command that creates API and controller code for a new version.
Troubleshoot
advanced
2:30remaining
Operator SDK: Debugging a failed operator build
You run make docker-build but get an error: cannot find module providing package sigs.k8s.io/controller-runtime. What is the most likely cause?
AThe Go modules are not properly initialized or dependencies are missing in go.mod.
BDocker daemon is not running, so the build cannot access the network.
CThe operator-sdk CLI version is outdated and incompatible with the project.
DThe Kubernetes cluster is not reachable, causing the build to fail.
Attempts:
2 left
💡 Hint
Check if your Go dependencies are correctly set up before building.
Best Practice
expert
3:00remaining
Operator SDK: Recommended way to test your operator locally
Which approach is the best practice to test your Operator SDK Go operator locally before deploying to a Kubernetes cluster?
ABuild the operator image and push it to Docker Hub, then deploy it to a remote cluster.
BUse <code>operator-sdk test local</code> to run end-to-end tests against a live cluster.
CRun the operator binary locally with <code>make run</code> and connect to a local kind cluster.
DManually apply CRDs and resources using kubectl without running the operator binary.
Attempts:
2 left
💡 Hint
Local testing usually involves running the operator process directly connected to a test cluster.