StaffCoder
Kubernetes
15 modules · 60 challengesSign up
Module 1 · Pods & Containers

Contained Workload Bring-Up

easyWorkload Bring-UpStatus Reporting100%1 of 1 solved

Problem statement

Three workloads - a server, a configured variant, and a one-shot task - must be brought up from bare manifests, each proving what it runs, how it is configured, and how it ends. manifest.yaml holds a single placeholder pod and report.sh prints nothing.

Two pods are already in the namespace. legacy-poller is crashing on a loop - not yours to fix, but yours to report on truthfully, so leave it running. stale-debug is rubbish left behind by someone's debugging session - remove it, and nothing else.

About this exercise

This brings together the topic's three exercises:

  • Pod identity: name, labels, image, declared port, and reading placement from status (First Pod Manifest)
  • Configuration: overridden command and arguments, literal and downward-API environment (Command, Args & Environment)
  • Lifecycle: restart policies that fit the workload, restart counts and last-state exit records (Restart Policies & Lifecycle)

Everything here lives in namespace bringup.

How this project is graded

The grader reads manifest.yaml, inspects every pod's live status, runs commands inside the configured variant, and runs your report.sh. So the manifest must be correct and applied, and the report must read the cluster each time rather than print a remembered answer.

What you will build

1. manifest.yaml - three pods in namespace bringup, documents separated by ---.

storefront - the server

  • image nginx:alpine, container named web, declared port 80
  • labels app=storefront, tier=web
  • must be Running with its container ready

storefront-batch - the configured variant

  • image busybox:1.36, container named worker
  • labels app=storefront, tier=batch
  • runs a command and arguments of your choosing instead of the image's defaults, and stays alive
  • environment: MODE=batch, SHARD=3, plus POD_NAME and POD_NAMESPACE carrying this pod's own name and namespace, taken from the pod itself

inventory-sync - the one-shot task

  • image busybox:1.36, container named task
  • labels app=inventory-sync, tier=task
  • prints something and exits 0; must reach Succeeded with no restarts

2. report.sh - one line per pod in the namespace, sorted by name:

<name> <phase> <ready> <restarts>

Values come from the live cluster. Once your three workloads are up and the stale pod is gone:

inventory-sync Succeeded false 0
legacy-poller Running false 3
storefront Running true 0
storefront-batch Running true 0

The tests

  • Pod_server_running_ready_with_exact_metadata - the server is up with the identity you declared
  • Pod_status_reports_placement_and_ip - the cluster recorded where it went and what address it got
  • Config_variant_runs_the_overridden_command - the variant runs your command, not the image's
  • Config_literal_and_downward_env_in_place - all four environment values readable inside the container
  • Lifecycle_task_succeeds_without_restarts - the task finished and stayed finished
  • Lifecycle_seeded_crash_shows_backoff_and_exit_reason - the failing workload's restarts and exit record read correctly
  • Composition_report_matches_live_status - the report matches what the cluster says right now
  • Composition_deletion_removes_exactly_the_targets - the stale pod removed, every other workload untouched

When every test passes

You have:

  • Three workloads brought up from one file, each with the identity, configuration and lifecycle its job needs
  • A report built from live status that tells the truth about all four pods, the failing one included
  • A cleanup that removes exactly what you name and nothing else
  • The next topic unlocked

Verify

Click Test.

More in Pods & Containers

See the module
First Pod ManifestDeclare a pod with labels and a container port, apply it, and read what the cluster decided - phase, readiness, node and IP.25%1 of 4 solvedeasyCommand, Args & EnvironmentOverride a container's command and arguments and inject literal plus downward-API environment variables, proven from inside the container.100%1 of 1 solvedeasyRestart Policies & LifecycleGive a completing task and a crashing server the restart policies their lifecycles need, and read phases, restart counts and exit reasons from status.100%1 of 1 solvedeasy

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.