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:

kubectl get deployments

βœ… 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!

πŸ“§ Contact

For questions or feedback, reach out:

πŸ“¨ Email: projects@briankimemia.is-a.dev 🌐 Portfolio: Brian Kimemia GitHub: BrianKN019


Thank you for exploring this project! Let’s innovate and build secure AWS solutions together. πŸš€