☸️ Cloud Track - Intermediate
K8s Deployment
Deploy your app to Kubernetes with Ingress, TLS certificates, and horizontal pod autoscaling.
⏱️ 8-12 hours
🎯 Intermediate
📋 Overview
Moving from Docker Compose to Kubernetes is a big leap. This project teaches you Deployments, Services, Ingress configuration, and production-ready patterns.
🔨 Implementation
Step 1: Create Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: app
image: myapp:v1
ports:
- containerPort: 3000
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
Step 2: Configure Ingress with TLS
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myapp-ingress
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
tls:
- hosts:
- myapp.example.com
secretName: myapp-tls
rules:
- host: myapp.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend
port:
number: 80
Step 3: Enable HPA (Horizontal Pod Autoscaler)
kubectl autoscale deployment frontend --cpu-percent=70 --min=2 --max=10
📦 Deliverables
- ✓Application running on K8s with 3+ replicas
- ✓Ingress with valid TLS certificate
- ✓HPA scaling based on CPU metrics
- ✓Liveness/Readiness probes configured