Back to Terraform

Capstone J: Operate an Isolated Kubernetes Workload

November 6, 2026 Wasil Zafar 42 min read

Deliver one workload with explicit API, controller, identity, network and persistent-data boundaries.

Table of Contents

  1. Define the Minimal Service and Its Cost Boundary
  2. Partition Identity, State, Artifacts and Data Ownership
  3. Promote a Reviewed Plan and Immutable Application Artifact
  4. Prove the Service Through Positive and Negative Cases
  5. Recover a Controlled Failure and Submit the Evidence

Define the Minimal Service and Its Cost Boundary

A capstone is a release a reviewer can reject. You will operate one small internal service on Kubernetes, split it across two roots and one data surface, promote one immutable image, prove it with positive and negative cases, break it once on purpose, and hand over six deliverables. The system is deliberately dull; the evidence is the work.

The service is an append-only ledger behind a ClusterIP Service. One StatefulSet, one replica, one 1Gi claim and four routes. A client pod in the same namespace appends an entry, reads it back by id, and asks whether the process is alive or actually ready. Nothing is reachable from outside the cluster.

RouteMethodData callWhat it proves
/entriesPOSTwrites one file, then fsyncs itthe write path and the claim
/entries/{id}GETreads one filethe read path and the not-found branch
/healthzGETnonethe process is running
/readyzGETwrites and removes a sentinel filethe volume, the mount and the permission

One small file per entry is a design choice that pays for itself twice. A single append-only log would turn the failure in the last section into a truncation problem with an open file handle. One file per entry makes a read a directory lookup and makes a bad record removable by deleting one file, which is exactly the recovery the lab needs.

No Ingress and no load balancer is a cost decision as much as a security one. A ClusterIP Service needs no certificate, no DNS record and no hourly charge, and it keeps the acceptance test inside the cluster where the network policy is the only boundary under test. An ingress controller would add a second data plane and a second owner to a project that already has four surfaces.

Identity is two service accounts with almost nothing between them. The runtime identity holds no grant at all and does not mount a token, so a compromised container has nothing to present. The verifier identity may read pods and pod logs in this namespace and do nothing else, which gives the negative case a precise expected answer.

Sharing a cluster is a prerequisite, not an assumption. The namespace, the StorageClass and the CNI belong to someone else, and each answer either changes the design or stops it.

PrerequisiteHow to verifyIf it fails
A namespace you may write toa dry-run create of the ConfigMaprequest the namespace and record the delay
A CNI that enforces policy in both directionsthe plugin's documentation plus a running policy agent on every nodechoose another cluster; a stored policy is not isolation
A CSI driver and a StorageClassread the class list and its provisionercreate the class in the platform root, or stop
Pod Security at restrictedone deliberately privileged pod in a scratch namespacelower the level as a written decision with its own owner
A registry the nodes can pull fromone pull from a node, not from your laptopuse a registry the cluster already trusts
A named reviewer and approverboth names in D1the capstone has no gate

The cost ceiling is a number with stop rules. Set USD 15 for a 72-hour window, then bound every driver that could reach it. A budget alert is a lagging signal, so the stop rules are what actually end the spend.

DriverBound written into the scope recordWhat breaks the ceiling
Nodestwo small nodes, or an existing sandbox poolautoscaling enabled with a high maximum
Persistent diskone 1Gi claim with Retaina claim per rollout, or a snapshot schedule
Image storageone repository, a bounded set of digestspushing every build forever
TrafficClusterIP onlya LoadBalancer Service added "just to check"
Control planethe cluster's existing managed feea second cluster for the denied namespace
Observabilitycluster-default events and pod logsa per-request log line carrying the payload

Scope is two lists, and the exclusion list is the useful one. "The service" cannot fail a test; "one namespace, one StatefulSet, one claim, one port" can.

BoundaryIncludedExcluded
Trafficone ClusterIP Service on port 8080Ingress, load balancers, certificates
Computeone replica, one pinned image, one ConfigMapautoscaling, a second workload
Dataone 1Gi claim per ordinal, Retainsnapshots, replication, in-place migration
Operationspod logs, events, two plansa log pipeline, dashboards, on-call

Figure 1 is the decision the scope record has to make before the first apply.

Define the Minimal Service and Its Cost Boundary
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    S["Scope record
one namespace, one StatefulSet, one 1Gi claim"] --> P{"Shared cluster or
dedicated sandbox?"} P -->|"shared"| A["Namespace-scoped access
the cluster owner applies the platform root"] P -->|"dedicated"| B["Cluster admin
one person holds both roots"] A --> Q{"Does the CNI enforce policy
in both directions?"} B --> Q Q -->|"no"| X1["Stop
a stored policy is not isolation"] Q -->|"yes"| C{"CSI driver and
a StorageClass?"} C -->|"no"| X2["Stop
create the class, or pick a cluster"] C -->|"yes"| D["Cost ceiling USD 15
with its stop rules"] D --> R{"Reviewer accepts D1?"} R -->|"no"| X3["Stop
no credential issued"] R -->|"yes"| K["Platform root, then workload root
one image digest pinned"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class S,R primary; class P,Q,C,D warn; class A,B,K secondary; class X1,X2,X3 danger;

The same requirement can pass one check and fail the next. A cluster that enforces policy but has no CSI driver stops at the claim, and a cluster with storage but no enforced policy passes every apply and fails the denied case. Figure 2 separates the four surfaces so the owner of each gap is obvious before anyone builds.

Four ownership surfaces stacked from the cluster to the stored bytes The cluster layer belongs to the platform team and holds the CNI policy engine, the StorageClass and the admission configuration. The namespace layer belongs to the namespace owner and adds quota, a limit range, Pod Security labels and a default-deny network policy. The workload layer belongs to the service team and holds a ServiceAccount with no token, a StatefulSet pinned to an image digest and a ClusterIP Service. The data layer belongs to the data owner and holds the claim created per ordinal, a retained PersistentVolume and the disk, which never appears in Terraform state. Each row names one thing that owner may do and one thing that owner must not do. Four surfaces, four owners, one workload Each layer can be correct while the next one is wrong. The owner column says who answers for it. Cluster · platform owner CNI policy engine enforces ingress and egress StorageClass Retain, one CSI driver Admission config Pod Security, quota plugin Namespace capstone-j · namespace owner Quota and LimitRange object counts, compute ceiling Pod Security labels restricted, pinned version NetworkPolicy default deny, one allow rule Workload · service team ServiceAccount no token, no binding StatefulSet one replica, digest pinned Service ClusterIP on port 8080 Data · data owner Claim, ordinal 0 created by the controller PersistentVolume Retain, cluster-scoped Disk 1Gi, never in state Platform team may change class and CNI no namespaced object applies Namespace owner may set quota and policy must not exceed the cluster limit Service team may release one digest must not edit the class or quota Data owner decides retention and restore must not delete without a decision Ceiling: one cluster, one namespace, one 1Gi claim, no Ingress, no load balancer, USD 15 for 72 hours. A clean plan proves the namespace and workload layers. Isolation and bytes are proven from the cluster.

Six deliverables keep the project reviewable. Each one is an artifact a reviewer can open, not a claim in a chat message.

IDDeliverableAccepted when
D1Scope, cost and prerequisite recordone namespace, one claim, a ceiling and its stop rules
D2Ownership matrixevery object has one root, one state key and one owner
D3Two applied rootsplatform then workload, no console edits, no extra objects
D4Promotion recordplan digest and image digest approved together, applied once
D5Acceptance matrixpositive and negative cases, each with its evidence source
D6Failure and cleanup reportone controlled failure recovered, two no-change plans, an inventory

A prerequisite that fails during acceptance is a mystery; one that fails during preflight is a decision. The difference is whether the answer was written down before the first apply, and D1 is where it lives.

Partition Identity, State, Artifacts and Data Ownership

Two roots exist because two lifetimes fail differently. The platform root owns what outlives the workload: the namespace, the StorageClass and the state key that describes them. The workload root owns only namespaced objects that can be destroyed and rebuilt. Neither root owns the claim, because the StatefulSet controller creates it.

State keys are named for the boundary. Write them as platform/cluster and workload/capstone-j in the team's existing remote backend, and let the platform root own the bucket policy and the lock. A workload root that creates its own backend has made the state a workload resource.

Backend recovery is independent of workload deletion. Because destroying the workload removes namespaced objects and never the state key, restoring a previous state version is a read taken with the platform identity while the namespace is untouched. A root where the state and the workload share an owner has no such path: the destroy that removed the objects also removed the record of them.

The namespace is the retention boundary, and deleting it is a data decision. Namespace deletion cascades to claims, Secrets and Services. The PersistentVolume is cluster-scoped, so it survives, and the class's reclaim policy decides whether the disk follows. With Retain, the volume moves to Released and the bytes stay until someone with a name decides what they are for.

Identity is partitioned by verb, and one identity has no credentials at all. A shared kubeconfig across plan, apply and runtime is how a namespace-scoped project quietly gains cluster rights.

IdentityUsed byMay doMust not do
Platform operatorthe platform apply jobcreate the namespace and the StorageClasscreate namespaced workloads
Workload operatorthe workload apply jobapply the objects in one namespacetouch another namespace or a cluster-scoped object
Verifierthe acceptance Jobread pods and pod logs in this namespacecreate, update or delete anything
Runtimethe ledger containerread its mounted ConfigMap, write its claimpresent a token to the API server

A cross-root reference is a variable, never a state read. The platform root publishes the namespace name and the StorageClass name; the workload root consumes them as inputs recorded in the promotion record. Reading the other root's state would give the workload root a transitive read of everything the platform holds, which is a boundary leak that no plan would show.

The registry is outside both roots. If the repository sat in the workload root, destroying the workload would delete the rollback targets at exactly the moment rollback matters. Immutable tags and a bounded retention policy make it a durable surface with one owner.

Figure 3 assigns one owner to each object and turns every cross-root dependency into a named artifact.

Ownership map across the platform root, the workload root and the data surface The platform root owns the state key, the namespace and the StorageClass with Retain. The workload root owns the quota, limit range, Pod Security labels, service accounts, ConfigMap, Service, StatefulSet and network policy, and nothing cluster-scoped. The data surface owns the claim created per ordinal, the PersistentVolume and the disk, none of which appear in either state file. Handoff artifacts are the namespace and class names as variables, and the claim template as a reference. A warning notes that the controller creates the claim, so no root can plan its deletion. One owner per object, artifacts across the boundary A shared credential or a duplicated object is an ownership bug, not a convenience. Platform root platform/cluster State key and lock owned here, referenced by both Namespace capstone-j Pod Security labels attached StorageClass Retain, expansion off Cluster-scoped only no pods, no claims, no Service Workload root workload/capstone-j Quota, LimitRange, labels the namespace's shape ServiceAccounts and Role runtime and verifier ConfigMap and Service ClusterIP on port 8080 StatefulSet and policy one replica, one digest Data surface not in state Claim, ordinal 0 created by the controller PersistentVolume cluster-scoped, Retain Disk, 1Gi billed hourly while it exists Inventory and restore the decision lives here Handoff artifacts Platform exports the namespace and class names as inputs to the workload root. The workload root exports the claim template name; the controller, not Terraform, creates the claim. Two blind spots, one owner each No root can plan the claim's deletion, and destroying the namespace deletes it while the Retain PV stays behind.

Read the map in both directions. Every box has exactly one root, and every arrow is a variable or a template name. An arrow that carries a credential means the boundary leaked, even while both plans stay clean.

Figure 4 follows the mechanics, including the branches that produce a valid plan with the wrong owner.

Partition Identity, State, Artifacts and Data Ownership
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    B["Platform root applied
namespace, class, state key"] --> K["Workload root planned
namespaced objects only"] K --> L{"Backend reachable
and lock free?"} L -->|"no"| X1["Apply blocked
nothing changed"] L -->|"yes"| A["Workload root applied
one digest, one replica"] A --> S["StatefulSet controller
creates the claim"] S --> P{"Claim Bound?"} P -->|"no"| X2["Pod Pending
read the provisioner event"] P -->|"yes"| M["Pod mounts the claim
readiness touches the data"] M --> OK["Two roots applied
one pod Ready"] S -.->|"template renamed"| X3["New claim, empty disk
old PV Released"] A -.->|"namespace destroyed"| X4["Claims go with it
Retain decides the disk"] B -.->|"state key in the workload root"| X5["Destroy removes the record
of what it destroyed"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class B,A,S primary; class K,M secondary; class L,P warn; class OK ok; class X1,X2,X3,X4,X5 danger;

A shared object is a bug that presents as drift. Two roots declaring the same object alternate ownership forever, and each apply looks like the other team's mistake.

SymptomCollapsed boundaryFirst evidence
A plan rewrites the namespace the workload did not createboth roots declare itthe plan address list
Init fails after the namespace is gonethe state key lived in the workload rootthe backend error at init
The claim survives a teardown with no ownerRetain was chosen, and inventory was notthe cluster and cloud volume lists
The pod starts on a new empty diskthe claim template name changed in a releasethe new claim's UID

The matrix is reviewed before the first credential. A boundary that exists only in a diagram is a preference. The matrix is what an operator reads at three in the morning, when the question is who may delete the claim and who has to sign for it.

Promote a Reviewed Plan and Immutable Application Artifact

Promotion is two digests and one signature. The image digest is what ran the tests, the plan digest is what describes the infrastructure change, and the approval covers both at the same moment. A plan approved against one digest and applied with another is an unreviewed deployment with a reviewed filename.

FieldWhat it recordsWhy it matters
Commit and treethe configuration that was revieweda moved branch invalidates the plan
ToolchainTerraform 1.17.1, hashicorp/kubernetes 3.5.0a different producer makes a different plan
Lock filecommitted provider selections and hashesa silent provider upgrade changes behaviour
Plan digestthe SHA-256 of the saved plan filethe applied bytes match the reviewed bytes
Image digestthe artifact that ran the acceptance casesthe tested code is the promoted code
Cluster contractnamespace, class and CNI from D2a stale contract plans against the wrong cluster
Approver and expirya named human and a deadlineapproval is for a change, not for a season

Pin the producer, not just the product. Both roots declare the version constraint and both commit their lock file. The CI image that runs Terraform is pinned by digest too, because a plan built by a different binary is a different plan even when the source is identical.

The artifact is immutable before Terraform sees it. Tags are immutable in the registry, the StatefulSet references an image by digest, and no field anywhere says latest. A rebuild produces a new digest, which is a new release; a moved tag is not a release, it is a coincidence.

Plan and apply are separate jobs with separate identities. The saved plan is encrypted at rest, readable by the named reviewers and the apply role, and kept for the rollback window. The apply job verifies the digest and the approval expiry before it configures the provider.

OrderCommand shapeWhat it produces or proves
1terraform init with the root's backend configthe root bound to its own key
2terraform plan -out=tfplanthe reviewed change, saved
3terraform show -json tfplanthe machine-readable record
4shasum -a 256 tfplanthe digest the approver signs
5terraform apply tfplanexactly the reviewed bytes
6terraform plan -detailed-exitcodeexit 0 means no drift, 2 means a diff

The order across roots is part of the design. Apply platform, then workload; destroy workload objects, then take the data decision, then destroy the namespace. That last step is the one place where the usual reverse order is wrong, because the namespace owns the claim and the claim owns the cascade.

There is no schema migration in version one, and that is a decision. The entry format lives in the image, so changing it is an artifact release with its own digest. Changing the claim template is a new claim and an empty disk, which is a migration with a copy step, never a settings edit.

Rollback is a digest and a variable. Because the registry kept the previous image, rollback is a new plan that changes one input to the previous digest, followed by a normal apply. It is still a reviewed change; it simply has a known-good destination and no rebuild.

Figure 5 contrasts the promoted path with the two shortcuts that pass a review without earning it: re-planning after approval, and a tag that is rebuilt between the test run and the apply.

The promoted path compared with re-planning after approval and a moving tag The promoted path builds an image, records its digest, produces and saves a plan, reviews both digests, applies the saved plan and verifies the workload at runtime with a readiness call and one entry read. The rejected path approves plan one, re-plans after approval, applies a change nobody reviewed, rebuilds the same tag with a new digest and creates a reviewed filename over an unreviewed change. Promote the reviewed artifact, not the latest diff Approval attaches to two digests. If either moves after approval, the approval is void. Promoted path Build image digest recorded Plan and save digest recorded Two-person review both digests signed Apply saved plan no re-plan Runtime verification ready call plus one entry read Rejected path Approve plan v1 the review is real Re-plan after approval is stale Apply plan v2 nobody reviewed it Rebuild the same tag a new digest, same name Reviewed filename, unreviewed change the next reader cannot tell the difference A saved plan expires. Once it does, the change needs a new plan, a new digest and a new approval. The apply job checks approval, expiry and digest before the provider is configured.

A promotion record is written before the apply and completed after it. The approver, the expiry and both digests go in first; the observed result and the timestamp go in second. A record reconstructed from memory at the end of the day is a story with a hash in it.

Prove the Service Through Positive and Negative Cases

Apply success is the beginning of the evidence. The matrix below is the project's acceptance test, run against the deployed workload with the deployed identities. A case that records a status code without naming the layer that produced it is an anecdote.

IDCaseActionExpected resultEvidence source
P1Writeappend one entry from the client pod201 and one new fileresponse and the entry count
P2Read backread the same id200 with the stored bodyresponse body
P3Livenesscall the health route200 with no data callthe probe's history
P4Readinesscall the ready route200 after the sentinel writethe pod's Ready condition
P5Restartdelete the pod and wait for the controllerthe earlier entry is still readablethe read plus the new pod name
N1Other namespacerepeat P2 from the denied namespacedeadline exceededan empty server log for that request
N2Verifier writescreate a pod as the verifier identity403 from the API serverthe RBAC error text
N3Privileged podapply a privileged container403 naming restrictedthe admission message
N4Over-quota podrequest more than the quota has left403 naming exceeded quotathe quota message with used and hard
N5Unknown idread an id never written404 with no writethe response body

The layer that answers tells you which control failed. Three different owners, three different fixes, and the status code alone will not separate them.

ResultDecided byOwnerFirst place to look
403 before any object existsthe API server authorizernamespace ownerthe Role and the binding's subject
403 naming a policyPod Security admissionnamespace ownerthe namespace label and the pod spec
403 naming a quotathe quota admission pluginnamespace ownerthe hard map and current usage
Timeout with no server logthe CNI at the pod interfaceplatform teamthe policy's selector, direction and port
404 with a clean logthe applicationservice teamthe id, not the infrastructure

Readiness is a data-plane claim, so it has to touch the data. The health route proves the process is up; the ready route writes and removes a sentinel on the claim. Without that write, a full disk and a detached volume both look like a healthy pod.

Rollout is proven by the claim, not by the revision. Change the image digest input, apply, and watch the controller replace its single pod. The new revision proves the spec changed; reading the entry written before the rollout proves the volume followed it.

Telemetry is four sources with four owners. The response body belongs to the application, the container log to the service team, the pod's conditions and events to the kubelet, and the plan to the platform. A cluster-wide log pipeline is a cluster-scoped service; name its owner in D2 rather than assuming it exists.

Every negative case names its control. A timeout records the policy and the direction, a 403 records the plugin, and a 404 records the application. A denial attributed to the wrong control passes the status check and fails the design.

Figure 6 places the six outcomes on one path and shows which layer answers each one.

Six request outcomes and the layer that decides each one A write and a read reach the application and return 201 and 200. An unknown id returns 404 from the application. A verifier identity that tries to write is refused by the API server authorizer with 403 before any object exists. A privileged pod and an over-quota pod are refused at admission with 403. A request from another namespace is dropped at the pod interface by the CNI, so the client sees a timeout and the server records nothing. The evidence panel names where each answer can be read. One path, six outcomes, four owners The status code names the layer only if you also record where it was produced. Write and read P1 and P2 Unknown id N5 Verifier writes N2 Privileged pod N3 Over-quota pod N4 Other namespace N1 Container reads and writes its claim decides 201, 200, 404 and the readiness result API server authorizer RBAC unions the grants and has no deny rule Admission plugins Pod Security and quota run inside the API server and reject the object CNI at the pod interface the policy is enforced here and the packet is dropped 201 and 200 one new file, then its body 404 from the app no write, no denial 403 at the authorizer no object is created 403 naming restricted the pod never starts 403 naming quota used and hard, in the text Timeout, no status the server logged nothing Where the evidence is A 403 with no object is an authorization decision. A 403 naming a control is admission, not RBAC. A timeout with an empty server log is a packet filter, not a bug. A 404 needs no infrastructure change. A NotReady pod is a data or mount problem. Record the layer, not just the number. Each answer has one owner in D2. A negative case is evidence only when it names the control, the layer and the request.

Run the matrix twice. The first run proves behaviour; the second, after a no-change plan in both roots, proves nothing moved underneath the passing result. A case that passes only on the first run is a timing dependency wearing a green tick.

Figure 7 turns the matrix into the evidence flow, including the branch where a passing test produces nothing a reviewer can use.

Prove the Service Through Positive and Negative Cases
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    B["Baseline
one allowed write, one denied request"] --> P["Positive cases
append, read, restart the pod"] P --> N["Negative cases
namespace, RBAC, PSA, quota, unknown id"] N --> T{"Does the evidence name
the deciding layer?"} T -->|"no"| X1["Re-run
record the source, not the status"] T -->|"yes"| E["Evidence table
one row per case"] E --> G{"Any case red?"} G -->|"yes"| X2["Stop
no promotion"] G -->|"no"| R["Rollout by digest
the earlier entry still reads"] R --> OK["Acceptance signed
D5 complete"] P -.->|"the pod was never deleted"| X3["Restart never proven
identity and data untested"] N -.->|"timeout blamed on the app"| X4["Wrong control fixed
the boundary stays open"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class B,P,N,R primary; class E secondary; class T,G warn; class OK ok; class X1,X2,X3,X4 danger;

A passing matrix is not a promoted service. Acceptance closes when the matrix, the promotion record and the two no-change plans exist together, because each one covers a different failure: behaviour, provenance and drift.

Recover a Controlled Failure and Submit the Evidence

Choose one failure that no plan can see. Fill the claim: append one entry larger than the space that remains, from the client pod. Nothing in either root changes, the architecture is intact, and the next write fails inside the container while the volume is still Bound.

LayerBefore the appendAfter the appendTerraform view
Write201 with a new id500 with no space left on deviceno change
ReadinessReady trueReady false after the sentinel write failsno change
Service endpointsone endpointnone, so the client cannot reach itno change
PodRunning and ReadyRunning, not Readyno change
Workload root planno changesno changesthe failure is not configuration
Platform root planno changesno changesthe boundary held
VolumeBound, space availableBound, no space leftnot in state at all

State the hypothesis before you touch anything. Expected: a write failure reporting no space left on device, readiness flipping to false, the Service losing its only endpoint, and both plans clean. A hypothesis that cannot be wrong is not a test, it is a description.

Inject through the data path, not through a commit. A commit would make the change legitimate and hide it from the plan for the wrong reason. An append is usage, so the plans stay clean by design, and the timeline starts at the moment of the append.

Recovery is a data decision followed by a verification. Write the options down, choose one, and record the ones you did not take.

OptionRight whenChosen here
Delete the oversized entryone bad record, volume otherwise healthyyes, one file removed
Grow the claimthe dataset is legitimate and the class allows expansionno, recorded as the untested path
Restore a snapshotthe disk is corrupt or the data is unrecoverableno, no snapshot exists in this design
Rebuild the volumethe volume itself is unusablerejected, it destroys the evidence

Expansion is a one-way ratchet, which is why it is the second choice. Kubernetes cannot shrink a claim, so growing the volume during an incident spends capacity permanently to fix one record. The class also has expansion off in this project, so the honest answer is that the option is a reviewed change with its own plan, not a rescue.

Recovery is verified by four sources, not by the absence of an error. The write returns 201, readiness returns 200, the Service has an endpoint again, and both roots still plan no change. Record the first success timestamp next to the failure timestamp, because the pair is the evidence.

Cleanup is an ordered inventory with a named owner. Each row has an owner and a verification, because "destroy everything" is not a step anyone can check.

OrderObjectOwnerVerified by
1Verifier identity and test callersworkloadthe old credential is refused
2StatefulSet, Service, ConfigMapworkloadapply of the destroy plan, zero to add
3Evidence archivedworkloadreadable after the namespace is gone
4Policy, quota, limit range, rolesworkloadthe namespace describes none of them
5Claim deleted deliberatelydatathe PV moves to Released
6Retained PV and diskdatathe cloud volume list shows none for this project
7StorageClassplatformthe class list no longer shows it
8Namespaceplatformthe namespace list no longer shows it
9State keys and lock filesplatformthe backend lists no key for the destroyed roots

Step five is the decision, and step eight is the cascade. Deleting the namespace before the data decision removes the claim without a recorded reason, and the Retain volume then outlives every owner who knew what it was for.

Lab

Recover a Controlled Failure and Submit the Evidence

Status: design-only. No cluster was created or modified to produce this capstone, and these steps were not executed here. Versions: Terraform CLI 1.17.1, hashicorp/kubernetes 3.5.0, verified 6 November 2026.

Prerequisites. A namespace you may write to, a CNI that documents and enforces NetworkPolicy in both directions, a CSI driver with a StorageClass you may reference, a registry the nodes can pull from, and a small client image with a shell and an HTTP client. Confirm that the Pod Security level on the namespace is the one you intend, because a restricted namespace refuses the privileged case with a policy message rather than a quota one.

Deliverables to attach. D1 scope and cost record, D2 ownership matrix, D3 two applied roots, D4 promotion record, D5 acceptance matrix, D6 failure and cleanup report. The review is not complete until every acceptance row has an artifact behind it.

StageActionPass condition
Preflightplan the platform and workload roots, save both plansboth plan, digests recorded, no unexpected destroys
Applyplatform, then workloadtwo applies, no console edit, one pod Ready
Positivewrite, read, health, readiness, pod restart201, 200, 200, 200, the entry survives
Negativeother namespace, verifier write, privileged pod, over-quota pod, unknown idtimeout, 403, 403, 403, 404
Telemetryread the container log and the pod eventsthe denial appears once, in the right source
Promotionapprove plan digest and image digest togetherone apply of the saved plan
Failureappend one oversized entry500, Ready false, no endpoint, both plans clean
Recoveryremove the entry, repeat the cases201, Ready true, endpoint back
Reconcileplan both roots with the detailed exit codeexit 0 twice
Teardownfollow the cleanup inventory in orderevery row verified, no orphan volume
  1. Record the baseline. Apply the namespace and the class, then the namespaced objects; save both plan digests and confirm one pod is Ready with one Bound claim. Do not continue until the baseline is boring.
  2. Prove the allowed path. Append one entry from the client pod, read it back by id, and call the health and ready routes. Expect 201, 200, 200, 200, and record the entry id and the file's size.
  3. Prove persistence across a restart. Delete the pod and wait for the controller to replace it, then read the same id again. Expect the same body and a new pod name, which proves the volume followed the ordinal rather than the container.
  4. Prove the denied path. Repeat the read from a pod in the second namespace where no allow rule names it. Expect a deadline exceeded rather than an HTTP error, because a packet filter has no status to return.
  5. Prove the identity boundary. Attempt a pod create as the verifier identity and read the error. Expect 403 from the authorizer, with no object created and no admission message.
  6. Prove admission. Apply a privileged container into the namespace and expect 403 naming restricted. Then request more CPU than the quota has left and expect 403 naming exceeded quota with used and hard in the message.
  7. Read the telemetry. Confirm the denial appears in the container log only where it should, and that the pod events name the probe failure when readiness flips. A denial with no matching source is a finding.
  8. Promote. Approve the plan digest and the image digest, apply the saved plan, and confirm the StatefulSet reports the approved digest. Record both digests in D4 before the apply and the result after it.
  9. Announce the failure window. Name the expected signal, the recovery owner and the data decision in advance. The window is short, and the announcement is what makes the later timeline credible.
  10. Inject. Append an entry larger than the free space, record the time, and stop writing. Expect the write to fail with no space left on device, readiness to flip, and the Service to lose its endpoint.
  11. Observe, then decide. Read the pod conditions, the events and both plans, then choose the data option from the table above. Removing the oversized entry is the chosen repair; expansion stays recorded and untested.
  12. Recover and reconcile. Remove the entry, repeat the write, read and readiness cases, and record the first success. Plan both roots with the detailed exit code and expect 0 from each.
  13. Teardown in order. Archive the evidence, delete the workload objects, delete the claim deliberately, confirm the PV is Released, then delete the retained PV and its disk in the cloud console, and finish with an inventory that returns nothing.

Expected observation. The client reaches the service in its own namespace and times out in the other, the entry survives a pod replacement, the verifier identity is refused before an object exists, and the injected append produces a write failure with both plans clean. Removal of one file restores the write, readiness and the endpoint, and the first success is timestamped after the failure.

Failure checks. The review fails if the timeout is "fixed" by widening a network policy without naming the control, if the 403 in step five carries an admission message instead of an authorization one, if the entry does not survive the restart, if either root shows a diff during the incident, if the injected failure is cleared by editing the claim in place, or if the destroyed namespace leaves a disk that no row in the inventory names.

Cost boundary. One namespace, one pod, one 1Gi claim, one ClusterIP Service and a handful of short-lived client and verifier pods. The real charges are the node hours behind the cluster and the disk while it exists; the ceiling is USD 15 for the 72-hour window, with stop rules that forbid a load balancer, a second cluster and a snapshot schedule. Confirm current pricing before the apply, and stop at the ceiling written in D1 rather than at the first surprising invoice.

Cleanup. Follow the nine-row inventory: credentials, workload objects, evidence, policies, claim, disk, class, namespace, state keys. The claim and the disk are the two rows that need a decision rather than a command, and the namespace is the row that must come after both.

Evidence to keep. Both plan digests, the promotion record with the image digest, the acceptance matrix with its evidence sources, the denial text and the request that produced it, the failure and recovery timestamps, the data decision with its rejected alternatives, the ownership matrix, the cleanup inventory, and the two final no-change plans. Keep the evidence; discard the credentials.

References (checked 6 November 2026): StatefulSets, network policies, persistent volumes, Pod Security Admission, service accounts, and the provider's StatefulSet, NetworkPolicy and StorageClass references.

An isolated workload is a set of owned surfaces with proof at each one. The project passes when a reviewer can name the owner of every object, replay the promotion from its two digests, read a negative case and see which control produced it, watch one data failure recover with both plans unmoved, and confirm that the teardown left nothing behind. That is a stronger result than a green apply, and it is the result this capstone asks you to deliver.