- Lab
-
Libraries: If you want this lab, consider one of these libraries.
Hands-On with the Kubernetes API
In this hands-on lab, you will go beyond kubectl to interact directly with the Kubernetes API server using raw HTTP requests. Starting with a running cluster, you will map the API's hierarchical structure to understand how resources are organized across Core and Named API groups. You will then manage the full lifecycle of Kubernetes resources through direct HTTP calls, applying advanced patching strategies and resolving concurrency conflicts. Finally, you will architect an event-driven interaction pattern using the API's watch mechanism to track cluster state changes in real time, handling disconnections and maintaining synchronization using bookmarks.
Lab Info
Table of Contents
-
Challenge
Navigate the Kubernetes API Structure
- Start kubectl proxy and query the API root to confirm unauthenticated local access to the control plane.
- Query
/apiand/apisto distinguish Core resources from Named API groups and identify preferred versions. - Retrieve the OpenAPI v3 specification for the Pod and Container schemas to identify required fields and validation constraints.
-
Challenge
Manage Resource Lifecycle with Raw HTTP
- Create a Pod by sending a POST request with a JSON manifest and verify its Running status with a GET request using the resource URI.
- Apply a Strategic Merge Patch to add labels without removing existing ones, then apply a JSON Merge Patch to a Deployment to observe how it replaces entire lists and loses unspecified fields.
- Trigger a 409 Conflict by attempting a PUT with a stale resourceVersion, then resolve it using the read-modify-write pattern with a fresh resourceVersion.
-
Challenge
Watch Cluster State in Real Time
- Open a persistent watch connection and create, label, and delete a Pod to capture
ADDED,MODIFIED, andDELETEDevents in the stream. - Compact etcd to purge watch history, attempt to resume from an old resourceVersion to trigger a 410 Gone, and recover using the list-then-watch pattern.
- Enable watch bookmarks to receive
BOOKMARKcheckpoint events, then extract the last resourceVersion to demonstrate efficient watch resumption without a full re-list.
- Open a persistent watch connection and create, label, and delete a Pod to capture
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.