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.
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
| Phase | Kubernetes-specific decision and evidence |
|---|---|
| 1 Framework | Record context, namespace, cluster owner, workload owner and access policy. |
| 2 Beginner | Explain Pods, Deployments, Services, Jobs, volumes, namespaces and reconciliation. |
| 3 Architecture | Choose managed/self-managed control plane, failure domains, ingress, identity, database and storage class. |
| 4 Provision | Recreate cluster/node/network prerequisites through reviewed provider tooling; confirm actual node readiness. |
| 5 Foundation | Configure RBAC, restricted pod security, network policy and external secret delivery. |
| 6 Service | Deploy exact image/config, separate migration Job and API/worker lifecycles. |
| 7 Go live | Validate readiness, Service routing, ingress/DNS/TLS and authenticated workflow. |
| 8 Operate | Observe events, workloads, node pressure, control-plane/etcd health and delivered user-impact alerts. |
| 9 Change | Test rollout, graceful shutdown, scaling, disruption and version compatibility. |
| 10 Recover | Rebuild workload and recover data, secrets/configuration and cluster state under the chosen responsibility model. |
| 11 Retire | Migrate consumers; inspect retained PVCs, cloud load balancers, volumes and identities before deletion. |
| 12 Assess | Diagnose 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:
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:
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.
Lock in what you just learned (3 quick questions)
requests and limits on Kubernetes container specs?CrashLoopBackOff, which two kubectl commands reveal the root cause fastest?