Lab 03 - The Kubernetes API and kubectl
Lab 03 - The Kubernetes API and kubectl
InfodiscoverGoal: answer any Kubernetes question from the terminal - and see the HTTP behind kubectl. Chapter: The Kubernetes API and kubectl
Try each task first; the box holds one working answer.
Task 1. List every kind the cluster knows. Find the short name and API
group of deployments, and whether it is namespaced.
Task 2. List the kinds that are not namespaced.
Task 3. Which API group/versions does the server offer? Is there more than one version of anything?
Task 4. Without the internet, find which fields go under
spec.containers[].resources of a Pod, and what spec.restartPolicy accepts.
Task 5. Show the HTTP requests kubectl sends for kubectl get pods -n kube-system. Expected: a GET https://...:6443/api/v1/namespaces/kube-system/pods.
Task 6. Read the list of Deployments in kube-system straight from the
API path, without the get deploy command.
Task 7. Open a local proxy on port 8001 and list the Pod names in
kube-system with curl.
Task 8. Create a Pod explorer (nginx:1.27), then print only its IP
and node.
Task 9. Show the stored object of explorer and find two fields you never
wrote: terminationGracePeriodSeconds and dnsPolicy.
Task 10. Show the events of explorer, then its log.
Task 11. Are you allowed to delete nodes? List everything you may do.
Clean up
kubectl delete pod explorer
api-resources (what exists), explain (what fields), describe (what
happened), logs (what the app said).