StaffCoder
Kubernetes
15 modules · 60 challengesSign up
Module 2 · kubectl Inspection & Debugging

Reading Cluster State

easykubectl Get & DescribeOutput Formats & JSONPath—No data yet

Problem statement

Every question about the cluster is answered by guesswork: nobody can say what runs where, in what state, or since when. The namespace triage is running seven workloads right now - some healthy, some stuck. Answer six questions about them from the cluster itself.

About this exercise

A namespace is the folder Kubernetes keeps objects in. Names are unique per namespace, and almost every command is namespace-scoped: a listing shows the current namespace only, which is why a pod you know exists can appear to be missing. Everything in this exercise lives in triage.

Two commands answer everything here, and the difference between them matters:

  • kubectl get prints objects from the API. Its default table is a summary; the output format decides what you actually see. There is a wider table that adds placement and addresses, and a form that extracts individual fields by path out of the object's JSON - the same paths you see in kubectl get pod X -o yaml. Listings can also be ordered by any field of the object rather than by name.
  • kubectl describe renders one object as a page, and adds something get never shows: the events the cluster recorded about it - scheduling decisions, image pulls, failures.

kubectl get --help and kubectl explain pod.status are the reference for the flags and the field paths.

How this project is graded

The grader compares your saved answers against the live cluster: extracted values must match exactly, listings must contain the right rows in the right order. Everything is read-only - nothing you do here should change the namespace.

What you will build

Six answers in answers/, listed in answers/questions.md:

placement.txt   every pod with the node it is on and its IP
image.txt       the image of the container in pod checkout-web        (exactly that string)
node.txt        the node ledger-worker was placed on                  (exactly that name)
ips.txt         the IP of every pod, one per line
by-age.txt      every pod listed oldest first
events.txt      a full description of search-indexer, including its events

Step 1 - what runs where

Produce the placement listing, and extract the two single values exactly - no labels, no surrounding table.

wide_listing_shows_placement_and_addresses, jsonpath_extracts_exactly_the_image and jsonpath_extracts_exactly_the_node should pass

Step 2 - one field, every pod

Extract every pod's IP as a plain list, one per line.

every_pod_ip_extracted_one_per_line should pass

Step 3 - order and history

Order the listing by age, and capture what the cluster has recorded about the pod that will not start.

listing_sorted_oldest_first and describe_surfaces_the_events_section should pass

When every test passes

You have:

  • The cluster's own answer to "what runs where", instead of guesswork
  • Single fields extracted exactly, ready to feed another command
  • Listings ordered by what you care about
  • The events trail that explains why a pod is stuck

You do not have yet:

  • Anything the processes said. Logs and in-container checks are the next exercise.

Verify

Click Test after every step.

More in kubectl Inspection & Debugging

See the module
Logs & ExecRead what containers actually said - current and previous instances, tail limits, the right container - and check in-container truth with exec.—No data yeteasyEvents & Field SelectorsDiagnose stuck workloads from the cluster's own record - events filtered by object, reason and type, each failure named by its cause.—No data yeteasyCluster Triage KitOne read-only sweep over a namespace: placement and state, log and in-container evidence, and an event-rooted diagnosis for every broken workload.—No data yeteasy

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.