AWS from Zero to Production — Phase 4, Part 4 of 6 · See the full series roadmap
Kubernetes is the most popular container platform in the world. It’s also the source of more “we spent six months on the platform and shipped nothing” stories than any other technology.
Both things are true.
Kubernetes gives you a powerful, portable, extensible API for running containers — and an enormous ecosystem. It also gives you a lot of moving parts to understand, upgrade, and secure.
This article teaches you the Kubernetes fundamentals, shows how Amazon EKS runs them on AWS, and helps you answer the honest question: does your team actually need it?
What you’ll walk away with
- ☸️ Kubernetes basics: pods, deployments, services, ConfigMaps, Secrets, and ingress
- 🏗️ What Amazon EKS manages — and what you still manage
- 🖥️ Managed node groups, Fargate profiles, and EKS Auto Mode
- 🔐 IAM Roles for Service Accounts vs. EKS Pod Identity
- 📈 Cluster autoscaling with Cluster Autoscaler and Karpenter
- ⚖️ The AWS Load Balancer Controller
- 🤔 ECS vs. EKS: an honest comparison
Kubernetes fundamentals
Kubernetes is an open-source system for running containers across a cluster of machines. You describe the desired state in YAML; Kubernetes continuously works to make reality match.
The core objects
- Pod: the smallest unit — one or more containers that share a network and storage. Pods are disposable.
- Deployment: keeps a number of identical pods running and handles rolling updates and rollbacks.
- Service: a stable name and IP for a set of pods, because pod IPs change constantly.
- ConfigMap: non-sensitive configuration, injected as environment variables or files.
- Secret: sensitive values. By default, they’re only base64-encoded, not encrypted — so on EKS, enable envelope encryption with KMS, or pull secrets from Secrets Manager.
- Ingress: HTTP routing rules from outside the cluster to services.
- Namespace: a way to divide one cluster between teams or environments.
A minimal deployment and service
apiVersion: apps/v1
kind: Deployment
metadata:
name: orders-api
spec:
replicas: 3
selector:
matchLabels: { app: orders-api }
template:
metadata:
labels: { app: orders-api }
spec:
containers:
- name: orders-api
image: 111122223333.dkr.ecr.us-east-1.amazonaws.com/orders-api:1.0.0
ports:
- containerPort: 8080
resources:
requests: { cpu: 250m, memory: 256Mi }
limits: { memory: 512Mi }
readinessProbe:
httpGet: { path: /health, port: 8080 }
---
apiVersion: v1
kind: Service
metadata:
name: orders-api
spec:
selector: { app: orders-api }
ports:
- port: 80
targetPort: 8080
kubectl apply -f orders-api.yaml
kubectl get pods
kubectl rollout status deployment/orders-api
Engineer’s note: Always set resource requests and readiness probes. Without requests, the scheduler can’t place pods sensibly. Without readiness probes, traffic hits pods before they’re ready.
Amazon Elastic Kubernetes Service (EKS)
Amazon EKS runs the Kubernetes control plane for you: the API server and etcd, spread across multiple AZs, patched and scaled by AWS.
What AWS manages
- Control plane availability, scaling, and patching
- Integration with IAM for cluster authentication
- Managed add-ons, like the VPC CNI, CoreDNS, and kube-proxy
What you still manage
- Kubernetes version upgrades — EKS supports each version for a limited time, and upgrades are your job to plan and test.
- Worker capacity — unless you use Fargate or Auto Mode
- Add-ons, ingress, observability, and policies
- Workload security: RBAC, network policies, and pod security
Cost note: EKS charges per cluster per hour, plus the compute your workloads use. Clusters on versions past standard support are charged more for extended support. Check current EKS pricing.
Where pods run: compute options
Managed node groups
EC2 instances in an Auto Scaling group, provisioned and lifecycle-managed by EKS. You choose instance types; EKS handles draining nodes during updates.
Fargate profiles
Pods that match a Fargate profile — by namespace and labels — run on Fargate, with no nodes to manage. Each pod gets its own isolated compute. Some features, like DaemonSets, aren’t supported.
EKS Auto Mode
EKS Auto Mode goes further: AWS manages the compute, scaling, load balancing, storage, and core networking add-ons for the cluster. It’s the closest Kubernetes gets to “just run my pods.”
Self-managed nodes
You run and manage the EC2 instances yourself. Maximum control, maximum work.
IAM for pods: IRSA and Pod Identity
Pods often call AWS APIs. Giving every pod on a node the node’s IAM role is far too broad. Instead, map a Kubernetes service account to an IAM role.
IAM Roles for Service Accounts (IRSA)
- Uses the cluster’s OIDC provider — the same federation pattern you used with GitHub in Phase 2.
- The IAM role’s trust policy names the service account.
- Annotate the service account with the role ARN.
EKS Pod Identity
- A simpler, newer approach. Install the EKS Pod Identity Agent add-on.
- Create a pod identity association between a service account and a role, through the EKS API.
- No OIDC provider per cluster, and roles can be reused across clusters more easily.
aws eks create-pod-identity-association \
--cluster-name prod \
--namespace orders \
--service-account orders-api \
--role-arn arn:aws:iam::111122223333:role/orders-api-pod
Recommendation: Use Pod Identity for new workloads, unless you need IRSA for a specific reason. Either way, one role per application, least privilege.
Autoscaling
Kubernetes scales at two levels:
Pods
The Horizontal Pod Autoscaler (HPA) adds and removes pod replicas based on CPU, memory, or custom metrics.
Nodes
When pods can’t be scheduled because there’s no room, you need more nodes:
- Cluster Autoscaler: the classic option. It adjusts the size of node groups (Auto Scaling groups).
- Karpenter: launches right-sized EC2 instances directly for pending pods, choosing from many instance types — including Spot — and consolidates underused nodes. Faster and usually cheaper. EKS Auto Mode uses Karpenter-based capacity management under the hood.
The AWS Load Balancer Controller
The AWS Load Balancer Controller watches Kubernetes objects and creates AWS load balancers for them:
- An Ingress becomes an Application Load Balancer.
- A Service of type
LoadBalancerbecomes a Network Load Balancer. - Pods can be registered directly as IP targets.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: orders-api
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
spec:
ingressClassName: alb
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: orders-api
port:
number: 80
ECS vs. EKS: the honest comparison
Choose ECS when
- You want to ship containers on AWS with the least operational overhead.
- Your team is small, or new to containers.
- You’re happy to be AWS-specific.
- You don’t need the Kubernetes ecosystem.
Choose EKS when
- Your organization has already standardized on Kubernetes.
- You need portability across clouds or on premises.
- You rely on the ecosystem: Helm charts, operators, service meshes, GitOps tools like Argo CD.
- You have, or will build, a platform team to own the cluster.
My take: Kubernetes is a great platform for platform teams. If you don’t have one, ECS on Fargate will get you to production faster, with less to maintain. That’s why this series’ main lab uses ECS — but everything you learn about images, roles, networking, and load balancers transfers directly to EKS.
Common mistakes
- Adopting Kubernetes for a handful of services with no one to own the cluster.
- Falling behind on Kubernetes versions and paying for extended support — or facing a rushed upgrade.
- Giving pods the node’s IAM role instead of Pod Identity or IRSA.
- No resource requests or readiness probes.
- Treating Kubernetes Secrets as encrypted by default.
- Running a single node group in one AZ.
Key takeaways
- Pods run containers, deployments manage pods, services give them stable names, and ingress exposes them.
- EKS runs the control plane; you still own upgrades, add-ons, and workload security.
- Managed node groups, Fargate profiles, and Auto Mode trade control for convenience.
- Use Pod Identity or IRSA so each app gets its own least-privilege IAM role.
- Karpenter scales nodes quickly and efficiently; HPA scales pods.
- ECS is simpler; EKS is more portable and extensible. Choose based on your team, not hype.
Quick self-check
Test yourself before moving on:
- Which Kubernetes object gives a set of pods a stable network name?
- What does EKS manage for you, and what’s still your job?
- What’s the newer alternative to IRSA for giving pods IAM permissions?
- What does the AWS Load Balancer Controller create for an Ingress?
Answers
- A Service.
- EKS manages the control plane; you still own version upgrades, add-ons, and workload security — and nodes, unless you use Fargate or Auto Mode.
- EKS Pod Identity.
- An Application Load Balancer.
What’s next
In Part 5, we go serverless: AWS Lambda, API Gateway, Step Functions, EventBridge, SNS, SQS, dead-letter queues, and the Serverless Application Model.
Has Kubernetes been worth it for your team? I’d love to hear both sides in the comments.