-
Create EKS Cluster with Managed Node Groups
Amazon EKS provides a managed Kubernetes control plane. Managed node groups automate node provisioning, updates, and scaling. You configure the cluster, AWS handles the infrastructure.
In EKS Console (right panel):
1. Click the "Cluster" tab at the top
2. In "Cluster name" field Type: shopstream-prod
3. In "Kubernetes version" dropdown Select "1.29 (Latest)"
4. In "Cluster endpoint access" Select "Public and private"
5. Under "VPC Configuration":
Select subnets in at least 2 AZs
Enable "Configure security groups"
6. Under "Node Group":
Instance type: "m5.large" (2 vCPU, 8GB RAM)
Desired size: 3, Min: 2, Max: 10
7. Check "Enable cluster autoscaler"
8. Click "Create Cluster" button
Cloud+ Concept: EKS abstracts control plane management. You pay $0.10/hour per cluster plus EC2 costs for worker nodes. Fargate profile eliminates node management entirely.
-
Configure Container Registry (ECR) with Image Scanning
Amazon ECR stores Docker container images. Enable image scanning to automatically detect vulnerabilities (CVEs) before deployment. Immutable tags prevent image overwrites.
ECR Configuration:
1. Click "Registry" tab
2. In "Repository name" field Type: shopstream/api-service
3. Check "Enable scan on push"
4. Check "Enable image tag immutability"
5. Under "Encryption":
Select "KMS encryption"
Choose customer-managed key
6. Create additional repositories:
shopstream/web-frontend
shopstream/cart-service
shopstream/payment-service
7. Click "Create Repositories"
Security: Block deployments with CRITICAL/HIGH vulnerabilities. Configure lifecycle policies to delete untagged images after 14 days to reduce costs.
-
Deploy Microservices with Kubernetes Deployments
Kubernetes Deployments manage pod replicas, rolling updates, and rollbacks. Define desired state in YAML, Kubernetes maintains it automatically. ReplicaSets ensure pod count matches specification.
Deployment Configuration:
1. Click "Workloads" tab
2. For "API Service" deployment:
Name: api-service
Replicas: 3
Container image: ECR URI from step 2
Container port: 8080
CPU request: 250m, limit: 500m
Memory request: 256Mi, limit: 512Mi
3. Configure liveness probe: HTTP GET /health on port 8080
4. Configure readiness probe: HTTP GET /ready on port 8080
5. Set rolling update strategy: maxSurge=1, maxUnavailable=0
6. Click "Deploy"
Resource Requests vs Limits: Requests guarantee resources. Limits cap usage. Set requests = typical usage, limits = peak usage. Prevents noisy neighbors.
-
Configure Kubernetes Services & Ingress
Services provide stable network endpoints for pods. ClusterIP for internal, LoadBalancer for external traffic. Ingress manages external HTTP/HTTPS routing with path-based rules.
Service & Ingress Setup:
1. Click "Networking" tab
2. Create ClusterIP services for internal microservices:
api-service:8080, cart-service:8080, payment-service:8080
3. Create Ingress resource:
Host: api.shopstream.com
Path /api/* api-service:8080
Path /cart/* cart-service:8080
Path /payment/* payment-service:8080
4. Enable AWS ALB Ingress Controller
5. Configure TLS with ACM certificate
6. Click "Apply Configuration"
Service Mesh: For advanced traffic management (canary, A/B testing, mTLS), consider AWS App Mesh or Istio. Service mesh adds observability and security.
-
Configure Horizontal Pod Autoscaler (HPA)
HPA automatically scales pod replicas based on CPU, memory, or custom metrics. Define target utilization, HPA adjusts replicas to maintain it. Essential for handling variable traffic.
HPA Configuration:
1. Click "Autoscaling" tab
2. Select deployment: "api-service"
3. Configure HPA:
Min replicas: 3
Max replicas: 50
Target CPU utilization: 70%
Target memory utilization: 80%
4. Advanced settings:
Scale up stabilization: 30 seconds
Scale down stabilization: 300 seconds
5. Check "Enable custom metrics" (requests per second)
6. Click "Create HPA"
7. Repeat for cart-service and payment-service
Scaling Strategy: Scale down slowly (5 min cooldown) to avoid thrashing. Scale up quickly (30s) to handle traffic spikes. Use KEDA for event-driven scaling.
-
Set Up Persistent Storage with EBS CSI Driver
Stateful applications need persistent storage. EBS CSI driver provisions AWS EBS volumes as Kubernetes PersistentVolumes. StorageClass defines provisioning parameters.
Storage Configuration:
1. Click "Storage" tab
2. Verify EBS CSI driver is installed (add-on)
3. Create StorageClass:
Name: ebs-gp3-encrypted
Provisioner: ebs.csi.aws.com
Volume type: gp3
IOPS: 3000, Throughput: 125 MiB/s
Encryption: enabled (KMS key)
4. Create PersistentVolumeClaim:
Name: database-pvc
Size: 100Gi
Access mode: ReadWriteOnce
5. Mount PVC in StatefulSet for database pods
Important: EBS volumes are AZ-specific. For multi-AZ, use EFS (NFS) or replicated databases. StatefulSets manage stateful workloads with stable identities.
-
Configure Secrets Management with AWS Secrets Manager
Never store secrets in container images or ConfigMaps. Use AWS Secrets Manager with the secrets-store-csi-driver to inject secrets as files or environment variables at runtime.
Secrets Setup:
1. Click "Secrets" tab
2. Create secrets in AWS Secrets Manager:
shopstream/prod/database-credentials
shopstream/prod/api-keys
shopstream/prod/payment-gateway
3. Install Secrets Store CSI Driver add-on
4. Create SecretProviderClass:
Provider: aws
Secret objects: map to Kubernetes secrets
5. Mount secrets in pod spec:
Volume mount path: /mnt/secrets
Or: Sync to Kubernetes secret for env vars
6. Configure IAM roles for service accounts (IRSA)
IRSA: IAM Roles for Service Accounts provides fine-grained AWS permissions per pod. No EC2 instance profile sharing. Principle of least privilege.
-
Implement Container Observability with CloudWatch Container Insights
Container Insights collects metrics, logs, and traces from EKS. Monitor CPU, memory, network at cluster, node, pod, and container levels. Set alarms for anomalies.
Observability Setup:
1. Click "Monitoring" tab
2. Enable CloudWatch Container Insights
3. Install CloudWatch agent DaemonSet
4. Install Fluent Bit for log collection
5. Configure metrics to collect:
Pod CPU/memory utilization
Container restart count
Network I/O
Storage utilization
6. Create CloudWatch alarms:
Pod pending > 5 minutes
Container OOMKilled events
Node NotReady status
7. Enable AWS X-Ray for distributed tracing
Prometheus Alternative: For open-source monitoring, deploy Prometheus + Grafana via Helm. Amazon Managed Prometheus (AMP) provides serverless Prometheus.