Production EKS and the Protected Runtime Boundary
Build the production cluster as a separately governed service boundary, not a larger copy of dev.
Run it in the public monorepo
This course is built around the public Zheta Kubernetes Lab monorepo. The excerpt below is runnable source, not pseudocode.
Source: infra/modules/environment/main.tf
resource "aws_subnet" "private" {
count = 2
vpc_id = aws_vpc.this.id
availability_zone = local.azs[count.index]
cidr_block = cidrsubnet(var.vpc_cidr, 4, count.index + 8)
tags = merge(local.tags, {
"kubernetes.io/role/internal-elb" = "1"
})
}
Code to reality
- Declared intent
- Place environment workloads across two private availability-zone subnets.
- Interpreter
- Terraform and the AWS provider create subnets and label them for internal Kubernetes load balancers.
- Software effect
- EKS and its controllers discover private network placement from stable subnet IDs and tags.
- Hardware effect
- AWS allocates isolated address ranges and routes network interfaces across two physical zones.
- Observable evidence
- Terraform outputs, AWS subnet inventory, EKS node addresses, and a private connectivity probe agree.
Start with the people and the result they need
The source tables below remain the detailed contract. Begin with these customer paths:
- D24-UC-01
- Person: Production platform engineer
- Job: Provision a protected multi-zone EKS runtime foundation
- Observable result: Private cluster API, baseline capacity, encryption, audit logs, tags, budget, and Aurora deletion protection match approved policy
- D24-UC-02
- Person: Production security approver
- Job: Ensure only the production deployment role can mutate the cluster boundary
- Observable result: Approved break-glass-free read succeeds and unapproved principals cannot administer the cluster
Turn each customer job into a testable story
Now turn each customer job into a story with a result that an engineer can check:
- D24-US-01
- Story: As a production platform engineer, I want policy-constrained EKS across independent zones, so that one capacity failure does not define the whole…
- Observable acceptance: Plan and AWS inventory identify private endpoint, zones, capacity, KMS keys, logs, budgets, tags, and deletion safeguards
- D24-US-02
- Story: As a production security approver, I want independently revocable production access, so that dev or staging authority cannot mutate customer runtime
- Observable acceptance: Positive and negative checks name principal, action, resource, expected and observed outcome, account, time, and audit event ID
Add real state and observable proof
Finally trace each story through the system that owns its state and the evidence that proves the outcome:
- D24-FLOW-01
- Trigger: Production change board approves the foundation plan digest
- Responsible systems: Terraform, VPC/endpoints, EKS, managed baseline node group, KMS, CloudWatch, budget, ECR, Aurora/Backup
- Authoritative state: Production remote Terraform state and AWS resource APIs
- Owned record: ProductionClusterRevision
- Observable evidence: Approval, actor, account, plan digest, cluster ARN, node IDs/zones, KMS/log refs, environment, timestamp, and run ID
- Failure signal: Wrong account, public endpoint, unhealthy node, encryption/logging gap, budget/tag failure, or Aurora deletion-policy violation
- D24-FLOW-02
- Trigger: A staging principal attempts production cluster administration
- Responsible systems: IAM, EKS access entries, Kubernetes RBAC/audit, CloudTrail
- Authoritative state: IAM policies and AWS audit stores; Kubernetes API only after explicit mapping
- Owned record: ProductionAccessGrant
- Observable evidence: Denied principal/action/resource, positive control, account, cluster, expected and observed outcomes, time, and event ID
- Failure signal: Unexpected access, shared role, stale session, missing audit event, or failed approved read
The enterprise problem and today’s slice
Enterprise problem: A production cluster can be technically identical to staging yet unsafe because deployment authority, failure domains, data protection, and deletion controls are weaker than the customer promise. Whole-course context: A staging dossier is an input only if it actually exists; today reviews the production foundation that may eventually receive a proven digest. Today’s slice: infra/stacks/prod derives zheta-forge-prod with a private EKS API, two private subnets, a three-node managed baseline, KMS Secrets encryption, five control-plane log types retained 365 days, a cost budget, immutable/scanned ECR, and deletion-protected Aurora with 35-day backups. EKS cluster deletion protection itself is not declared. End-of-day evidence: A real approved apply must prove these resources. Still unsolved: No AWS deployment or production launch evidence exists in this repository.
Customer use cases
Production readiness starts below the application because every pod depends on network, compute, identity, and control-plane availability. No customer traffic is admitted in this slice.
| Use case ID | Actor | Customer job | Success outcome | Denial or recovery evidence |
|---|---|---|---|---|
| D24-UC-01 | Production platform engineer | Provision a protected multi-zone EKS runtime foundation | Private cluster API, baseline capacity, encryption, audit logs, tags, budget, and Aurora deletion protection match approved policy | Single-zone, public API, unencrypted storage, or unprotected Aurora destroy plan is rejected |
| D24-UC-02 | Production security approver | Ensure only the production deployment role can mutate the cluster boundary | Approved break-glass-free read succeeds and unapproved principals cannot administer the cluster | Denied access entry or IAM action is recorded while the approved read remains a positive control |
Actor-centred user stories
Production controls must be observable before workloads arrive, or the first release becomes an unsafe infrastructure test. These stories make availability and authority falsifiable.
| Story ID | Use case IDs | User story | Observable acceptance conditions |
|---|---|---|---|
| D24-US-01 | D24-UC-01 | As a production platform engineer, I want policy-constrained EKS across independent zones, so that one capacity failure does not define the whole runtime | Plan and AWS inventory identify private endpoint, zones, capacity, KMS keys, logs, budgets, tags, and deletion safeguards |
| D24-US-02 | D24-UC-02 | As a production security approver, I want independently revocable production access, so that dev or staging authority cannot mutate customer runtime | Positive and negative checks name principal, action, resource, expected and observed outcome, account, time, and audit event ID |
End-to-end product flows
An approved Terraform apply creates infrastructure, not a launched product. The happy path deliberately stops at a protected empty cluster, and the denied path proves account isolation.
| Flow ID | Use case IDs | Path | Trigger | Numbered steps | Terminal evidence |
|---|---|---|---|---|---|
| D24-FLOW-01 | D24-UC-01 | Happy | Production change board approves the foundation plan digest | 1. Assume production deployment role with fresh approval. 2. Verify account and remote state. 3. Apply network and EKS modules. 4. Inspect private endpoint, zones, nodes, encryption, logs, tags, budgets, and protection. 5. Run no-workload readiness checks. | Approval, actor, account, plan digest, cluster ARN, node IDs/zones, KMS/log refs, environment, timestamp, and run ID |
| D24-FLOW-02 | D24-UC-02 | Denied | A staging principal attempts production cluster administration | 1. Verify the test principal has no production grant. 2. Request a bounded read or access entry. 3. Record denial. 4. Use the production read-only verifier as positive control. 5. Seal CloudTrail evidence. | Denied principal/action/resource, positive control, account, cluster, expected and observed outcomes, time, and event ID |
The smallest complete production foundation joins explicit human authority to an inspectable runtime boundary, without pretending a product is live.
System design derived from the flows
Managed EKS removes control-plane host operation, not customer accountability for worker, identity, networking, workload, and response health. Multi-zone capacity reduces one failure class but does not replace backup or disaster recovery.
| Use case ID | Entry point | Responsible services | Authoritative store | Failure evidence |
|---|---|---|---|---|
| D24-UC-01 | infra/stacks/prod approved plan | Terraform, VPC/endpoints, EKS, managed baseline node group, KMS, CloudWatch, budget, ECR, Aurora/Backup | Production remote Terraform state and AWS resource APIs | Wrong account, public endpoint, unhealthy node, encryption/logging gap, budget/tag failure, or Aurora deletion-policy violation |
| D24-UC-02 | Production deployment and verifier roles | IAM, EKS access entries, Kubernetes RBAC/audit, CloudTrail | IAM policies and AWS audit stores; Kubernetes API only after explicit mapping | Unexpected access, shared role, stale session, missing audit event, or failed approved read |
The stack adds the substrate ladder from private network through managed API to EC2-backed nodes. Audit controls make the foundation reviewable before workload delivery begins.
DRY keeps production on the same infra/modules/environment interface while one stack owns one account under SRP. Provider variables inject environment dependencies through IoC/DI; MVC and PubSub remain above this substrate and cannot override infrastructure ownership.
Data model and ownership
Production infrastructure and access records need independent retention because deleting a cluster must not delete proof of who approved it. No generated application exists in production yet.
Generated-application database: Not created in this slice — the protected cluster foundation needs only infrastructure, access, approval, audit, and evidence state.
| Record or entity | Store and owner | Primary key | Foreign key or opaque reference | Tenant key | Material constraint | Lifecycle and deletion | Use case IDs |
|---|---|---|---|---|---|---|---|
| ProductionClusterRevision | Terraform backend and AWS EKS, owned by Production Platform | cluster ARN plus stack revision | Opaque VPC, node group, KMS, log, budget, and role refs | environment_id | Dedicated account/state, private API, multi-zone capacity, encryption, audit, and protection required | Plan, approve, apply, upgrade; drain dependants before destroy; retain audit | D24-UC-01, D24-UC-02 |
| ProductionAccessGrant | IAM/EKS access, owned by Production Security | grant_id | Opaque principal, cluster, approval, and role refs | environment_id | Time-bounded least privilege and independent revocation; no dev/staging inheritance | Request, approve, activate, expire/revoke, retain audit | D24-UC-02 |
| FoundationEvidence | Evidence Store, owned by Operations Assurance | evidence_id | Opaque plan, cluster, node, key, log, access-test, and run refs | environment_id | Both approved observations and denied controls required | Append, seal at review, retain through cluster retirement, expire by policy | D24-UC-01, D24-UC-02 |
The production cluster, access grant, and evidence now have explicit owners and deletion outcomes. Audit remains after runtime retirement.
Inspect before admitting workloads
Applying workloads too early hides whether the substrate itself meets policy, so inspect the empty cluster first. Run this labelled snippet beside the public zheta-kubernetes-lab stable stack infra/stacks/prod; it deliberately inspects before applying gitops/apps/forge/overlays/prod.
: "${AWS_PROFILE:?set the approved AWS profile}" "${AWS_REGION:?set the intended AWS region}" "${EXPECTED_ACCOUNT_ID:?set the intended 12-digit AWS account}"
actual_account="$(aws --profile "$AWS_PROFILE" --region "$AWS_REGION" sts get-caller-identity --query Account --output text)"
[ "$actual_account" = "$EXPECTED_ACCOUNT_ID" ] || { echo "AWS account mismatch" >&2; exit 1; }
aws --profile "$AWS_PROFILE" --region "$AWS_REGION" sts get-caller-identity
aws --profile "$AWS_PROFILE" --region "$AWS_REGION" eks update-kubeconfig --name zheta-forge-prod --alias zheta-forge-prod
aws --profile "$AWS_PROFILE" --region "$AWS_REGION" eks describe-cluster --name zheta-forge-prod --query 'cluster.{arn:arn,status:status,endpointPublicAccess:resourcesVpcConfig.endpointPublicAccess}'
kubectl --context zheta-forge-prod get nodes -L topology.kubernetes.io/zone
aws --profile "$AWS_PROFILE" --region "$AWS_REGION" logs describe-log-groups --log-group-name-prefix /aws/eks/zheta-forge-prod/cluster
aws --profile "$AWS_PROFILE" --region "$AWS_REGION" budgets describe-budgets --account-id "$(aws --profile "$AWS_PROFILE" --region "$AWS_REGION" sts get-caller-identity --query Account --output text)"
These checks align with the Terraform resources, not aspirations. AWS documents that selected EKS control-plane log types are delivered to CloudWatch and may take a few minutes to appear (EKS control-plane logging); private-only kubectl still requires VPC or connected-network access.
| Effect field | What happens |
|---|---|
| Declared intent | Inspect the protected production foundation without deploying a product |
| Interpreter | AWS CLI and Kubernetes API read independently owned state |
| Software effect | No desired state changes; evidence gains fresh cluster, endpoint, node, zone, and log observations |
| Hardware effect | APIs consume minor network/compute; existing control plane and nodes continue running and billing |
| Evidence | Account, context, cluster status, private endpoint flag, Ready nodes/zones, log groups, timestamp, and run ID |
Key takeaways
Production is a governed runtime boundary before it is a destination.
- An Active control plane does not prove usable nodes or customer health.
- Account, VPC, state, roles, and cluster are isolated from dev and staging.
- Availability zones, encryption, audit, budgets, and deletion safeguards are explicit contracts.
Checklist
The foundation is ready for bootstrap only after policy and denial proofs agree.
- [ ] Production account, state, VPC, role, and cluster are unique
- [ ] API is private and baseline nodes span approved zones
- [ ] Encryption, audit logs, tags, budgets, and protection are visible
- [ ] Staging principal is denied while production verifier succeeds