Core Track Guardrails-first chapter in core learning path.

Estimated Time

  • Reading: 20-25 min
  • Lab: 45-60 min
  • Quiz: 10-15 min

Prerequisites

Source Code References

  • guard-kube-context.sh Members
  • guard-terraform-plan.sh Members

Sign in to view source code.

What You Will Produce

A reproducible lab result plus quiz verification and incident-safe operating evidence.

Core Exercises (Required)

To internalize the guardrails and the importance of change isolation, complete the following tasks:

  1. Split a Mixed PR: Take a hypothetical mixed PR (e.g., changing an image tag and a service port) and split it into two separate, clean pull requests.
  2. Trigger a Guardrail Failure: Intentionally run guard-terraform-plan.sh apply without a planfile and capture the failure output. Explain why the script stopped you.
  3. Verify Context: Switch your kubectl context to a non-existent namespace and run scripts/guard-kube-context.sh. Document the error message.

Challenge Exercise (Optional)

Blast Radius Detection Hook: Write a pre-commit hook script that detects when a single PR touches files in both flux/apps/ and flux/infrastructure/ directories. Explain why this pattern represents a correlated blast radius risk.

Rollback Checklist

Before finishing this chapter, ensure you know how to undo changes:

  • Deployment Change: Use kubectl -n <ns> rollout undo deployment/<name>.
  • Ingress Change: Revert the commit in Git and let Flux reconcile.
  • Infrastructure Change: Create a new reviewed Terraform plan for the rollback.

Done When

You have completed this chapter when:

  • You can explain why “small but mixed” changes are high risk.
  • You have successfully demonstrated the use of guard-kube-context.sh.
  • You have successfully demonstrated the use of guard-terraform-plan.sh.
  • You can distinguish between investigation, containment, and rollback phases.

Knowledge Check

Before finishing this chapter, complete the Quiz to verify your understanding of the guardrail principles.