Skip to main content
CRUCIBLE
Legacy Reference Archive: This 44-chapter book reference has been distilled into Academy A01 (8 Executable Modules) with Tier-Adaptive Productive Failure, Kore/Puck voice, and live Firecracker labs.
Open Academy A01 →
COURSE 0 · SERVER BUILDING & LIFECYCLE MASTERY

Zero-to-Production Linux, Containers, Networking & Recovery

PROGRESS: 0 / 72 (0%)0/44L · 0Q · 0VM
TRK 03 · 6 SPECIALIST SERVER TRACKS · 787 WORDS (5 MIN)

Kubernetes application and cluster track

The workspace infrastructure/kubernetes.yaml supplies API/worker Deployments, a Service, migration Job, namespace security labels and NetworkPolicy. Replace image digest, migration release ID and private database address.

FULL WAR-ROOM →
INTERACTIVE DELIVERY CONTRACT · CLICK ANY STAGE

Build Once, Promote Deliberately: Immutable Artifact & Volume Boundary

Why container layers stay disposable while named volumes and versioned migrations preserve state.

verifiesdeploysmountsPinned CommitGit SHA + LockfileCI Gate & DigestTests · Lint · SHA-256Ephemeral AppRead-only FS · Env SecretsDurable VolumeEncrypted Backups
SELECTED LAYER · PINNED COMMIT
Single source of truth with pinned dependency hashes so builds are bit-for-bit reproducible.
Common failure: Floating latest tags or unpinned packages causing "worked yesterday" production breaks.
$ python3 labs/foundations.py --text "build once verify always"

Prerequisites: container and networking foundations; a disposable cluster with a named context; working credentials; a reviewed image digest; private PostgreSQL; a CNI that enforces NetworkPolicy. Status: operational recipe and manifest specimen; no live cluster is implied by successful YAML parsing. Outcome: operate the workload through the cluster API and distinguish application failure from scheduling, network, storage and control-plane failure.

Map the lifecycle

PhaseKubernetes-specific decision and evidence
1 FrameworkRecord context, namespace, cluster owner, workload owner and access policy.
2 BeginnerExplain Pods, Deployments, Services, Jobs, volumes, namespaces and reconciliation.
3 ArchitectureChoose managed/self-managed control plane, failure domains, ingress, identity, database and storage class.
4 ProvisionRecreate cluster/node/network prerequisites through reviewed provider tooling; confirm actual node readiness.
5 FoundationConfigure RBAC, restricted pod security, network policy and external secret delivery.
6 ServiceDeploy exact image/config, separate migration Job and API/worker lifecycles.
7 Go liveValidate readiness, Service routing, ingress/DNS/TLS and authenticated workflow.
8 OperateObserve events, workloads, node pressure, control-plane/etcd health and delivered user-impact alerts.
9 ChangeTest rollout, graceful shutdown, scaling, disruption and version compatibility.
10 RecoverRebuild workload and recover data, secrets/configuration and cluster state under the chosen responsibility model.
11 RetireMigrate consumers; inspect retained PVCs, cloud load balancers, volumes and identities before deletion.
12 AssessDiagnose one failed rollout and one node/storage/network fault without mass-restarting the cluster.

Prepare the manifest deliberately

the Course 0 workspace's infrastructure/kubernetes.yaml supplies API/worker Deployments, a Service, migration Job, namespace security labels and NetworkPolicy. Replace image digest, migration release ID and private database address. Create separate runtime and migration credentials through the approved secret mechanism. Bootstrap the namespace and secrets first, run the migration Job to completion, seed credentials as a controlled one-off action, then start application workloads. Do not apply all sections blindly while a migration is still running.

Use explicit context flags in every command. The following examples use YOUR_LAB_CONTEXT as a visible placeholder; replace it with the reviewed context. These read-only checks must pass before mutation:

bash
kubectl config current-context
kubectl --context YOUR_LAB_CONTEXT get nodes
kubectl --context YOUR_LAB_CONTEXT get namespace mastery-lab
kubectl --context YOUR_LAB_CONTEXT auth can-i create deployments -n mastery-lab

A missing namespace during initial preparation is expected; a permission denial requires confirming scope, not switching to cluster-admin without review. Schema/server dry-run is useful after adapting the manifest, but it cannot prove that a CNI enforces policy, an image runs or a database is recoverable.

Exercise the application

After the controlled deployment has completed:

bash
kubectl --context YOUR_LAB_CONTEXT -n mastery-lab get deployments,pods,services,jobs
kubectl --context YOUR_LAB_CONTEXT -n mastery-lab rollout status deployment/api --timeout=120s
kubectl --context YOUR_LAB_CONTEXT -n mastery-lab get events --sort-by=.metadata.creationTimestamp
kubectl --context YOUR_LAB_CONTEXT -n mastery-lab port-forward service/api 18000:8000

Port-forward runs in the foreground. In a second terminal, use the usual synthetic job workflow against127.0.0.1:18000. This proves private application access through the forwarding path, not public ingress. Stop only that forwarding command after the lab.

For a failed Pod, inspect its description and container logs; distinguish ImagePullBackOff, configuration errors, failed probes, OOM termination and unschedulable requests. Logs may contain sensitive data; keep them protected. A Deployment maintains desired replicas, as explained by the [official stateless deployment tutorial](https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/). That does not mean an unavailable database or an incompatible schema can be repaired by adding Pods.

Introduce one scoped fault on owned workloads: an invalid image in a staging candidate or a stopped worker. Record rollout state, events and queue symptoms; restore the reviewed image/replica setting and verify completion. Deleting a healthy Pod only demonstrates replacement scheduling; it does not establish node-loss availability.

Stateful workloads and retirement

The supplied application manifest assumes private PostgreSQL outside the cluster. Moving PostgreSQL inside changes the responsibility boundary. StatefulSets provide stable identity/storage association; they do not configure database replication, backup or automatic safe failover. The [StatefulSet documentation](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) describes the controller model. Storage reclaim policies, snapshots and actual database consistency must be tested separately.

A cluster upgrade needs a supported version-skew plan, component/add-on compatibility, API deprecation checks and a workload recovery path. Measure capacity and constraints before enabling autoscaling. A disruption budget influences voluntary disruptions; it is not a guarantee against every node or zone failure.

For retirement, stop producers and scheduled Jobs, migrate data and consumers, remove ingress/traffic intentionally, then review namespace resources. List PVCs and cloud-controller-created resources before deleting anything. Namespace removal can trigger deletion of some resources while retained storage and external load balancers may persist; a complete receipt includes the provider inventory and credential revocation, not merely an empty kubectl listing.

ACTIVE-RECALL MASTERY CHECKPOINT · TRK 03

Lock in what you just learned (3 quick questions)

PASS 2/3 FOR +30 XP
Q1.Why define both requests and limits on Kubernetes container specs?
Q2.Why store application secrets in Kubernetes Secret objects backed by KMS/external secret stores rather than plaintext ConfigMaps?
Q3.When a Kubernetes Pod is stuck in CrashLoopBackOff, which two kubectl commands reveal the root cause fastest?
Answered 0 / 3