AWS Kubernetes Deployment - A Colorful Guide
Welcome to the AWS Kubernetes Deployment Guide!
This is not your typical documentation; itβs your visually rich and interactive pathway to Kubernetes success on AWS.
Prerequisites
-
β
An AWS Account ready with permissions for EKS.
-
β
Installed and configured AWS CLI.
-
β
Installed eksctl, kubectl, and Docker.
π‘ Pro Tip:
Use AWS CloudShell to run AWS CLI commands directly without local installation hassles.
β οΈ IAM Permissions Alert:
Ensure that your IAM role has appropriate policies attached, such as AmazonEKSClusterPolicy and AmazonEKSWorkerNodePolicy.
Step 1: Set Up an EKS Cluster
Install eksctl
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
π‘ Why eksctl?
eksctl simplifies Kubernetes cluster creation and management on AWS. Itβs a time-saver for DevOps engineers.
Create the Cluster
eksctl create cluster --name vibrant-cluster --region us-west-2 --nodes 3
β οΈ Cost Monitoring:
EKS clusters generate EC2, LoadBalancer, and other resource costs. Use AWS Budgets to track expenses.
Step 2: Deploy Your Application
Create a Deployment Manifest
apiVersion: apps/v1
kind: Deployment
metadata:
name: vibrant-app
spec:
replicas: 2
selector:
matchLabels:
app: vibrant-app
template:
metadata:
labels:
app: vibrant-app
spec:
containers:
- name: nginx
image: nginx:1.21
ports:
- containerPort: 80
π‘ Why YAML?
YAML files provide declarative configurations for Kubernetes. Easy to version-control and replicate!
Apply the Deployment
kubectl apply -f deployment.yaml
β
Success:
Use kubectl get deployments to confirm your application is live.
Verify Deployment:
β
Expected Output:NAME READY UP-TO-DATE AVAILABLE AGE
demo-app 3/3 3 3 2m
Step 3: Expose the Application
Create a Service
kubectl expose deployment vibrant-app --type=LoadBalancer --port=80
π Access Your App:
Use the LoadBalancerβs external URL to access your app in the browser.
π‘ Scaling Tip:
Adjust your app replicas on the fly:kubectl scale deployment vibrant-app --replicas=5
Advanced Steps
Enable Auto-Scaling
kubectl autoscale deployment vibrant-app --cpu-percent=70 --min=2 --max=10
π Dynamic Scaling:
Kubernetes Horizontal Pod Autoscaler ensures your app scales with traffic.
Use Helm Charts
helm install my-app stable/nginx
π‘ Why Helm?
Helm simplifies Kubernetes application deployment with pre-configured templates and charts.
β οΈ Cleanup Reminder:
Unused resources like LoadBalancers or EC2 instances can incur costs. Delete them when not needed:eksctl delete cluster --name vibrant-cluster
Resources
π Congratulations!
Youβve completed this colorful guide to Kubernetes deployment on AWS. Happy deploying!
For questions or feedback, reach out:
π¨ Email: [email protected]
π Portfolio: Brian Kimemia
GitHub: BrianKN019
Thank you for exploring this project! Letβs innovate and build secure AWS solutions together. π