Bird
Raised Fist0
AWScloud~10 mins

Deploying workloads on EKS in AWS - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Deploying workloads on EKS
Create EKS Cluster
↓
Configure kubectl
↓
Write Deployment YAML
↓
Apply Deployment
↓
Pods start running
↓
Verify workload status
↓
Done
This flow shows the steps to deploy an application on EKS: create cluster, configure access, write deployment, apply it, pods run, verify.
Execution Sample
AWS
eksctl create cluster --name my-cluster --region us-west-2
aws eks --region us-west-2 update-kubeconfig --name my-cluster
kubectl apply -f deployment.yaml
kubectl get pods
Creates an EKS cluster, configures kubectl, deploys a workload using a YAML file, then checks pod status.
Process Table
StepActionCommand/DescriptionResult/State
1Create EKS Clustereksctl create cluster --name my-cluster --region us-west-2Cluster 'my-cluster' created and ready
2Configure kubectlaws eks --region us-west-2 update-kubeconfig --name my-clusterkubectl configured to access cluster
3Write Deployment YAMLdeployment.yaml with container image and replicasDeployment manifest ready
4Apply Deploymentkubectl apply -f deployment.yamlDeployment created, pods starting
5Pods start runningkubectl get podsPods in Running state
6Verify workloadkubectl describe deployment my-appDeployment ready with desired replicas
7ExitAll pods running and workload deployedDeployment successful, process complete
💡 All pods are running and deployment is successful, so deployment process ends.
Status Tracker
VariableStartAfter Step 1After Step 4After Step 5Final
Cluster StateNoneCreatedCreatedCreatedCreated
kubectl ConfigNoneConfiguredConfiguredConfiguredConfigured
Deployment StatusNoneNoneCreatedPods RunningPods Running
Pods StateNoneNoneNoneRunningRunning
Key Moments - 3 Insights
Why do we need to configure kubectl after creating the cluster?
kubectl needs cluster access info to communicate with EKS. Step 2 shows configuring kubectl after cluster creation.
What happens if pods do not reach Running state after applying deployment?
Pods may be pending or failing. Step 5 shows pods starting; if not Running, check pod logs or events.
Why is writing a deployment YAML important before applying?
Deployment YAML defines what to deploy and how. Step 3 prepares this manifest, which kubectl uses in Step 4.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the cluster state after Step 1?
AConfigured
BNone
CCreated
DRunning
💡 Hint
Check the 'Cluster State' variable in variable_tracker after Step 1.
At which step do pods start running?
AStep 3
BStep 5
CStep 4
DStep 2
💡 Hint
Look at the 'Pods State' variable in variable_tracker and the execution_table rows.
If kubectl is not configured, what will happen when applying deployment?
Akubectl cannot connect to cluster, deployment fails
BDeployment applies successfully
CPods start running anyway
DCluster is automatically configured
💡 Hint
Refer to Step 2 and Step 4 in execution_table and kubectl Config variable in variable_tracker.
Concept Snapshot
Deploying workloads on EKS:
1. Create EKS cluster (eksctl).
2. Configure kubectl to access cluster.
3. Write deployment YAML with app details.
4. Apply deployment with kubectl.
5. Pods start running and workload is live.
Always verify pod status after deployment.
Full Transcript
To deploy workloads on EKS, first create a cluster using eksctl. Then configure kubectl to connect to the cluster. Next, write a deployment YAML file describing your application and how many replicas you want. Apply this deployment using kubectl apply. The pods will start running in the cluster. Finally, verify the pods are running and the deployment is ready. This process ensures your application runs on the managed Kubernetes cluster.

Practice

(1/5)
1. What is the main purpose of Amazon EKS when deploying workloads?
easy
A. To run containerized applications using Kubernetes without managing servers
B. To store large amounts of data in the cloud
C. To create virtual machines for running applications
D. To manage user access and permissions

Solution

  1. Step 1: Understand EKS functionality

    Amazon EKS is a managed Kubernetes service that lets you run containers without managing the underlying servers.
  2. Step 2: Compare options

    Storing data relates to services like S3, creating VMs to EC2, and managing permissions to IAM--none of which is EKS's core purpose.
  3. Final Answer:

    To run containerized applications using Kubernetes without managing servers -> Option A
  4. Quick Check:

    EKS = Managed Kubernetes for containers [OK]
Hint: EKS = Kubernetes service for containers, not storage or VMs [OK]
Common Mistakes:
  • Confusing EKS with storage services like S3
  • Thinking EKS manages virtual machines directly
  • Mixing EKS with IAM user management
2. Which of the following is the correct command to deploy an application using a YAML file named app-deployment.yaml on EKS?
easy
A. kubectl run app-deployment.yaml
B. eksctl create app app-deployment.yaml
C. aws eks deploy app-deployment.yaml
D. kubectl apply -f app-deployment.yaml

Solution

  1. Step 1: Identify the kubectl command for applying YAML

    The correct command to deploy resources defined in a YAML file is kubectl apply -f filename.
  2. Step 2: Evaluate other options

    kubectl run app-deployment.yaml is for running individual pods, not applying YAML manifests. eksctl create app app-deployment.yaml misuses eksctl, which is primarily for EKS cluster creation. aws eks deploy app-deployment.yaml is not a valid AWS CLI command.
  3. Final Answer:

    kubectl apply -f app-deployment.yaml -> Option D
  4. Quick Check:

    Deploy YAML with kubectl apply -f [OK]
Hint: Use kubectl apply -f for YAML deployment files [OK]
Common Mistakes:
  • Using eksctl for direct YAML deployment
  • Confusing kubectl run with apply
  • Trying AWS CLI commands that don't exist
3. Given this YAML snippet for a Deployment on EKS:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp-container
        image: nginx:latest

What will be the number of running pods after applying this deployment?
medium
A. 1
B. 3
C. 0
D. Depends on the node capacity

Solution

  1. Step 1: Read the replicas field in the Deployment spec

    The YAML specifies replicas: 3, which means Kubernetes will create 3 pods for this deployment.
  2. Step 2: Understand pod creation behavior

    Unless there is a scheduling issue, Kubernetes will run 3 pods as requested.
  3. Final Answer:

    3 -> Option B
  4. Quick Check:

    replicas = number of pods running [OK]
Hint: replicas field sets pod count in Deployment spec [OK]
Common Mistakes:
  • Assuming only 1 pod runs by default
  • Thinking pods depend on node capacity without error
  • Confusing selector labels with pod count
4. You tried to deploy a workload on EKS using kubectl apply -f deployment.yaml, but got an error: error: unable to recognize "deployment.yaml": no matches for kind "Deploy". What is the likely cause?
medium
A. The cluster is not running
B. kubectl is not installed
C. The YAML file has a typo in the kind field; it should be 'Deployment' not 'Deploy'
D. The image name in the YAML is incorrect

Solution

  1. Step 1: Analyze the error message

    The error says no matches for kind "Deploy", which means Kubernetes does not recognize this resource kind.
  2. Step 2: Check the YAML kind field

    The correct kind for workload deployment is "Deployment", not "Deploy". This typo causes the error.
  3. Final Answer:

    The YAML file has a typo in the kind field; it should be 'Deployment' not 'Deploy' -> Option C
  4. Quick Check:

    Kind field must be exact Kubernetes resource name [OK]
Hint: Check resource kind spelling in YAML for errors [OK]
Common Mistakes:
  • Ignoring error details about resource kind
  • Assuming cluster or kubectl issues without checking YAML
  • Blaming image name for syntax errors
5. You want to deploy a stateless web app on EKS that automatically scales between 2 and 5 pods based on CPU usage. Which combination of Kubernetes resources should you define in your YAML files?
hard
A. A Deployment with replicas set to 2 and a Horizontal Pod Autoscaler targeting CPU usage with max replicas 5
B. A StatefulSet with replicas 5 and a LoadBalancer service
C. A DaemonSet to run pods on every node and a Cluster Autoscaler
D. A Deployment with replicas fixed at 5 and a NodePort service

Solution

  1. Step 1: Identify resource for managing pod replicas with scaling

    A Deployment manages stateless pods and can be combined with a Horizontal Pod Autoscaler (HPA) to scale pods based on CPU.
  2. Step 2: Understand autoscaling setup

    Set Deployment replicas to minimum 2, and HPA to scale up to max 5 pods based on CPU usage.
  3. Step 3: Evaluate other options

    StatefulSet is for stateful apps, DaemonSet runs pods on all nodes (not scaling pods), fixed replicas do not autoscale.
  4. Final Answer:

    A Deployment with replicas set to 2 and a Horizontal Pod Autoscaler targeting CPU usage with max replicas 5 -> Option A
  5. Quick Check:

    Deployment + HPA = autoscaling pods [OK]
Hint: Use Deployment + HPA for CPU-based pod autoscaling [OK]
Common Mistakes:
  • Using StatefulSet for stateless apps
  • Confusing DaemonSet with autoscaling pods
  • Setting fixed replicas without autoscaler
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard