PeaBox Lab › PeaLang › Learn › Chapter 22 › Lesson 4

Part IV — Expert Production Engineering · Chapter 22 · Lesson 4 of 5 · 2 min read

Lesson 4: Graceful Drain, Manifest Validation, Soak Testing, and Operational Adaptation

Lesson level: Expert

Purpose: Operational readiness is demonstrated by end-to-end shutdown and recovery behavior, not just a manifest or a local PASS result.

Learning Objectives

4.1 Concepts

Drain stops admission, removes readiness, waits for accepted work, and then allows termination within a measured grace period. DrainController tracks active work only when application begin/end calls are wired around that work. The secure generator contains a preStop request to /drain, but the base serving app exposes no /drain route. Its shell and HTTP utility may also be absent from a minimal image. Add an authenticated internal drain implementation and verified image support rather than accepting a decorative shutdown hook.

4.2 Annotated Example

validate_manifests checks required document keys and selected container security fields. It does not validate the full Kubernetes schema, all probes, named ports, RBAC, or live network behavior. soak_test defaults to a short local interval; zero errors there are not a multi-hour production-style soak. Use host-level evidence for requests accepted, completed, timed out, and rejected during shutdown.

4.3 Guided Practice

Draw the shutdown timeline: mark unready, propagate endpoint removal, reject new work, complete accepted work, and terminate. Identify the maximum request duration and the grace-period relationship.

4.4 Common Mistakes

Do not call /drain without implementing it, mask preStop failures as proof of success, use a short local soak as release evidence, or deploy generated manifests without API-server validation.

4.5 Hands-On Lab

Deliverable: Policy or shutdown test matrix, observed evidence, and the adapted resources.

4.6 Review Questions

Why is the generated preStop hook insufficient? What does local validation omit? What distinguishes a unit soak from production-style evidence?

4.7 Applied Challenge

Write a shutdown and recovery runbook covering artifact reload, audit durability, shared-state recovery, and failed drain. Test it with no production traffic.

Lesson Summary

Operational readiness is demonstrated by end-to-end shutdown and recovery behavior, not just a manifest or a local PASS result.

Lesson status: Draft complete; ready for review. Source-checked, not cluster-validated.

← Previous Next →