Skip to content

Commit 0935401

Browse files
committed
updating eks blog for code refactors
1 parent 11fc96a commit 0935401

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

blog/posts/eks-fargate-framework.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ Here's the high-level flow automated by the framework:
7070
- Sends alerts through SNS
7171
- Supports ephemeral dashboards for short-lived environments
7272

73+
## Prerequisites
74+
75+
- Terraform >= 1.5
76+
- AWS CLI v2
77+
- kubectl, Helm >= 3.8
78+
- jq
79+
- Python 3.10+ (for pre-commit)
80+
7381
## Quick Start
7482

7583
To get started from scratch:
@@ -81,33 +89,37 @@ git clone https://github.com/its-d/terraform-aws-eks-microservice-framework.git
8189
cd terraform-aws-eks-microservice-framework
8290
```
8391

84-
**Prepare your environment**
92+
**Copy and edit config**
8593

86-
- 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+
```
89100

90101
**Deploy**
91102

92103
```bash
93104
make init
94-
make plan
105+
make plan # Prompts for Grafana credentials if not set
95106
make apply
96107
```
97108

98109
**Validate outputs**
99110

100111
```bash
101112
make outputs
113+
make grafana-url # Grafana access info
102114
```
103115

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).
105117

106-
## Why _confirm_ip Exists
118+
## Restricting EKS API Access
107119

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.
109121

110-
The `_confirm_ip` helper ensures:
122+
The `make confirm-ip` helper ensures:
111123

112124
- You never expose the cluster to the entire internet
113125
- You always know which IP is allowed
@@ -120,12 +132,12 @@ It's a small but critical step that prevents accidental misconfiguration and kee
120132
- **Use OIDC for GitHub Actions:** never store long-lived AWS keys.
121133
- **Adopt IRSA everywhere:** each controller or workload gets its own IAM role.
122134
- **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`.
124136

125137
## Lessons Learned
126138

127139
- 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.
129141
- Don't skip metrics: debugging Fargate pods without logs or dashboards is brutal.
130142
- Validate OIDC trust relationships in IAM before running CI/CD pipelines.
131143
- Match namespace selectors carefully when defining Fargate profiles — it's an easy mistake to overlook.

0 commit comments

Comments
 (0)