Skip to content

Commit 1eff11e

Browse files
committed
docs: add operator runbook; align teardown wrapper
1 parent cf14d66 commit 1eff11e

2 files changed

Lines changed: 149 additions & 0 deletions

File tree

docs/runbook.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# CloudOps Platform Runbook (Demo + Validation + Teardown)
2+
3+
This runbook is the operator guide for rebuilding, validating, presenting, and tearing down the CloudOps Platform demo safely.
4+
5+
## What this environment proves
6+
- Modular Terraform provisioning for AWS VPC + EKS
7+
- Ingress via NGINX behind AWS NLB with TLS (ACM) and HTTPS-only enforcement
8+
- HPA autoscaling under real CPU load (metrics-server gate + evidence)
9+
- Observability: Prometheus scrape + Grafana views for ingress traffic
10+
- Cost discipline: teardown prevents orphaned NLB, NAT gateways, and ENIs
11+
12+
---
13+
14+
## Prerequisites
15+
16+
### Required CLI tools
17+
- aws
18+
- kubectl
19+
- helm
20+
- terraform
21+
- jq
22+
- dig
23+
- curl
24+
25+
### AWS and Kubernetes
26+
- AWS credentials configured locally (or via assumed role)
27+
- Access to the EKS cluster defined by `EKS_CLUSTER_NAME` in `AWS_REGION`
28+
29+
---
30+
31+
## Environment variables (optional overrides)
32+
33+
### Core
34+
- `AWS_REGION` (default: `ca-central-1`)
35+
- `EKS_CLUSTER_NAME` (default: `cloudops-dev-eks`)
36+
37+
### Route53 (optional)
38+
Used only to create or update the DNS record for the demo:
39+
- `ROUTE53_ZONE_ID` (accepts `ZXXXX` or `/hostedzone/ZXXXX`)
40+
- `ROUTE53_RECORD_NAME` (example: `app.utieyincloud.com`)
41+
42+
### Application
43+
- `APP_NS` (default: `apps`)
44+
- `APP_HOST` (default: `app.utieyincloud.com`)
45+
- `APP_INGRESS_NAME` (default: `hpa-demo`)
46+
- `APP_POD_SELECTOR` (default: `app=hpa-demo`)
47+
48+
### Validation timing
49+
- `OBS_WINDOW_SECONDS` (default: `120`)
50+
- `OBS_INTERVAL_SECONDS` (default: `5`)
51+
52+
---
53+
54+
## Demo lifecycle (recommended order)
55+
56+
### Step 1: Rebuild the environment
57+
**Terraform + NGINX Ingress + Application**
58+
59+
Command:
60+
```bash
61+
./scripts/rebuild-demo.sh
62+
```
63+
64+
What this step does:
65+
- Runs `terraform apply` in `terraform/environments/dev`
66+
- Configures kubeconfig for the EKS cluster
67+
- Installs or upgrades ingress-nginx using an AWS NLB with ACM TLS
68+
- Enforces HTTPS-only external access
69+
- Deploys the demo application manifests
70+
- Optionally updates Route53 DNS (if configured)
71+
- Performs proof checks for HTTPS success and HTTP failure
72+
73+
Expected outcomes:
74+
- An AWS NLB hostname is printed
75+
- The application Ingress has an external address
76+
- HTTPS returns HTTP 200
77+
- HTTP access fails or times out (expected)
78+
79+
---
80+
81+
### Step 2: Validate the environment (evidence-oriented)
82+
83+
Command:
84+
```bash
85+
./scripts/validate-env.sh
86+
```
87+
88+
What this step validates:
89+
- Kubernetes context and node health
90+
- Ingress controller Service and NLB hostname
91+
- Metrics API availability (required for HPA)
92+
- HTTPS access (DNS optional via `--resolve`)
93+
- HTTP negative test (should not be the primary path)
94+
- HPA behavior observed over time (non-brittle reporting)
95+
96+
Expected outcomes:
97+
- HTTPS returns HTTP 200
98+
- Metrics API is Available or a warning is reported
99+
- HPA status shows replica counts and scaling decisions
100+
101+
---
102+
103+
### Step 3: Teardown (cost control discipline)
104+
105+
Command:
106+
```bash
107+
./scripts/teardown.sh
108+
```
109+
110+
What this step does:
111+
- Best-effort Kubernetes cleanup (apps and ingress first)
112+
- Attempts `terraform destroy`
113+
- If dependency violations occur:
114+
- Detects VPC ID
115+
- Removes NLBs, target groups, NAT gateways, ENIs, and other blockers
116+
- Retries `terraform destroy`
117+
- Final best-effort cleanup to prevent orphaned AWS resources
118+
119+
Expected outcomes:
120+
- Terraform state destroyed cleanly
121+
- No orphaned NLBs, NAT gateways, or ENIs
122+
- AWS account left in a cost-neutral state
123+
124+
---
125+
126+
## Common issues and recovery
127+
128+
### Terraform destroy fails with DependencyViolation
129+
Cause:
130+
- NLB, NAT gateway, or ENIs still exist
131+
132+
Resolution:
133+
```bash
134+
./scripts/teardown.sh
135+
```
136+
The script performs deep cleanup and retries automatically.
137+
138+
### HPA shows `<unknown>` metrics
139+
Cause:
140+
- Metrics Server not ready or Metrics API unavailable
141+
142+
Resolution:
143+
```bash
144+
kubectl get apiservice v1beta1.metrics.k8s.io
145+
kubectl top nodes
146+
kubectl -n apps top pods
147+
```
148+

scripts/tear.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
# Convenience wrapper. Canonical teardown logic lives in teardown.sh.
23
set -Eeuo pipefail
34
exec "$(dirname "$0")/teardown.sh" "$@"
45

0 commit comments

Comments
 (0)