You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Create `env/dev/backend.hcl` and `env/dev/terraform.tfvars` (examples included)
87
-
- Confirm your public IP: `make _confirm_ip`
88
-
This step restricts EKS API access to your current IP, preventing accidental 0.0.0.0/0 exposure.
94
+
```bash
95
+
cp terraform.tfvars.example terraform.tfvars
96
+
cp backend.hcl.example backend.hcl
97
+
# Edit terraform.tfvars: set region, identifier
98
+
# Edit backend.hcl: set bucket, key, region
99
+
```
89
100
90
101
**Deploy**
91
102
92
103
```bash
93
104
make init
94
-
make plan
105
+
make plan# Prompts for Grafana credentials if not set
95
106
make apply
96
107
```
97
108
98
109
**Validate outputs**
99
110
100
111
```bash
101
112
make outputs
113
+
make grafana-url # Grafana access info
102
114
```
103
115
104
-
You'll receive the cluster name, ALB endpoints, and Grafana URLs after deployment.
116
+
You'll receive the cluster name, ALB endpoints, and Grafana URLs after deployment. For Grafana, you can also get the URL from AWS Console → EC2 → Load Balancers (ALB for `monitoring` namespace).
105
117
106
-
## Why _confirm_ip Exists
118
+
## Restricting EKS API Access
107
119
108
-
Terraform and Helm both need to reach the EKS API endpoint during apply. If your IP isn't listed in `public_access_cidrs`, you'll hit TLS handshake or timeout errors.
120
+
By default, `public_access_cidrs` is `["0.0.0.0/0"]`. Use `make confirm-ip` to restrict EKS API access to your current IP. Terraform and Helm both need to reach the EKS API endpoint during apply — if your IP isn't listed in `public_access_cidrs`, you'll hit TLS handshake or timeout errors.
109
121
110
-
The `_confirm_ip` helper ensures:
122
+
The `make confirm-ip` helper ensures:
111
123
112
124
- You never expose the cluster to the entire internet
113
125
- You always know which IP is allowed
@@ -120,12 +132,12 @@ It's a small but critical step that prevents accidental misconfiguration and kee
120
132
-**Use OIDC for GitHub Actions:** never store long-lived AWS keys.
121
133
-**Adopt IRSA everywhere:** each controller or workload gets its own IAM role.
122
134
-**Enable observability early:** Grafana and CloudWatch should be part of the MVP, not an afterthought.
123
-
-**Destroy safely:**always remove Helm workloads before `terraform destroy` to avoid dependency conflicts.
135
+
-**Destroy safely:**use `make destroy` — it runs pre-cleanup (Helm uninstall, K8s resources, VPC endpoints, ALBs, ENIs; removes Helm/K8s from state), then terraform destroy. No manual steps required. If VPC DependencyViolation occurs, run `make destroy-retry`.
124
136
125
137
## Lessons Learned
126
138
127
139
- Start small: one namespace, one CI pipeline. Kubernetes and Terraform complexity compounds quickly.
128
-
-Confirm your IP before every apply, especially if you're using a VPN.
140
+
-Run `make confirm-ip` before every apply if restricting access, especially when using a VPN.
129
141
- Don't skip metrics: debugging Fargate pods without logs or dashboards is brutal.
130
142
- Validate OIDC trust relationships in IAM before running CI/CD pipelines.
131
143
- Match namespace selectors carefully when defining Fargate profiles — it's an easy mistake to overlook.
0 commit comments