Amazon EKS Cluster Creation & Deployment to AWS EC2 |Video upload date:  · Duration: PT1M0S  · Language: EN

Step by step tutorial to create an Amazon EKS cluster and deploy Docker images to EC2 based Kubernetes pods using eksctl kubectl and ECR

Why this exists and why you will love it in a resigned way

If you want Kubernetes on AWS that does not require a small island nation budget or repeated therapy sessions this guide shows how to create an Amazon EKS cluster and run a Docker image on EC2 backed nodes. You will use eksctl for cluster plumbing, ECR for storing images, and kubectl for the usual poking and prodding of pods.

Create the EKS control plane with eksctl

Yes you can type a single command and let eksctl do the heavy lifting. Make sure your AWS CLI is configured with credentials and the right region before you sulk at the terminal.

eksctl create cluster --name my-cluster --region us-west-2

This provisions the control plane and basic networking. If you want managed node groups for less maintenance or self managed EC2 instances for more control both are fine. Managed node groups are a nice compromise when you are not in a masochistic mood.

Optional create a node group or attach EC2 instances

Use eksctl to add a node group or use the console if you enjoy clicking things. Example with eksctl

eksctl create nodegroup --cluster my-cluster --name my-nodes --node-type t3.medium --nodes 2

Nodes register with the cluster so pods can schedule on regular AWS compute. Label node groups by purpose so you do not accidentally schedule the CI job on the database hardware.

Build your Docker image and push to ECR

Build locally, authenticate to ECR, then push. Replace REGISTRY with your ECR registry URI and myrepo with your repository name.

docker build -t myrepo/myapp .
aws ecr create-repository --repository-name myrepo
aws ecr get-login-password | docker login --username AWS --password-stdin REGISTRY
docker tag myrepo/myapp REGISTRY/myrepo/myapp
docker push REGISTRY/myrepo/myapp

Yes create-repository will fail if it already exists. That is not a bug, it is a feature that tells you to stop running the same script 12 times.

Create a Kubernetes deployment and service

Write a deployment manifest that points to your ECR image and a service to expose the pod. Keep the image field pointing to REGISTRY/myrepo/myapp and set imagePullPolicy if you need strict behavior.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: REGISTRY/myrepo/myapp
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: myapp-service
spec:
  type: LoadBalancer
  selector:
    app: myapp
  ports:
  - port: 80
    targetPort: 80

Apply manifests and check status

Use kubectl as if you are conducting a ritual that sometimes works.

kubectl apply -f deployment.yaml
kubectl get pods
kubectl get svc

If a pod is stuck use these trusty commands to find out why.

kubectl describe pod POD_NAME
kubectl logs POD_NAME

Quick debugging and scheduling tips

  • Check node readiness with kubectl get nodes
  • If image pull fails confirm the ECR registry URI and authentication
  • Use nodeSelector or node affinity and labels to control where pods land
  • Use kubectl describe to read events for scheduling and taints

Final notes and best practices

Follow access control and security group hygiene before exposing production workloads. Tag and label node groups by purpose, use private registries for sensitive images, and consider autoscaling if you hate manual capacity planning.

This guide covered cluster creation with eksctl, node group setup, Docker build and ECR push, creating Kubernetes deployment and service, and verifying pods on EC2 backed nodes. Go forth and deploy, and remember that logs are your friends and midnight rollbacks are not.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.