Introduction: Managing Containers at Scale

Welcome to this course on deploying containers with Amazon EKS! If you've worked with Docker containers before, you know they're great for packaging applications. But what happens when you need to run dozens or hundreds of containers across multiple servers? What if a container crashes and needs to restart automatically? What if you need to update your application without downtime? These are the challenges that Kubernetes was built to solve.

In this lesson, you'll learn what Kubernetes is and how Amazon EKS makes it easier to use. You'll also become familiar with the three command-line tools you'll be using throughout this course: aws, kubectl, and eksctl. By the end of this lesson, you'll understand the role each tool plays in managing your containerized applications on EKS.

What is Kubernetes?

Kubernetes is a container orchestrator. Think of it as a smart manager for your containers. Just as a restaurant manager decides which servers handle which tables, monitors if anyone needs a break, and brings in extra staff during busy hours, Kubernetes decides which servers run which containers, monitors their health, and scales them up or down based on demand.

Let's make this more concrete with a real-world example. Imagine you have a web application running in containers. Without Kubernetes, if that container crashes, your application goes down until someone manually restarts it. If traffic increases, you need to manually start more containers and figure out how to distribute traffic between them. If you want to update your application, you need to carefully coordinate stopping old containers and starting new ones without causing downtime.

Kubernetes solves these problems automatically. It continuously monitors your containers and restarts them if they crash. It can automatically scale the number of containers based on CPU usage or other metrics. It handles rolling updates, where new versions gradually replace old ones without downtime. It also manages networking so that containers can communicate with each other and external traffic can reach your application. These capabilities make Kubernetes essential for running production applications at scale.

What is Amazon EKS?

Amazon EKS stands for Elastic Kubernetes Service. It's AWS's managed Kubernetes offering, which means AWS handles the complex parts of running Kubernetes for you. To understand what this means, you need to know that Kubernetes has two main components: the control plane and the worker nodes.

The control plane is the brain of Kubernetes. It makes all the decisions about where containers should run, monitors the health of everything, and responds to changes. Running a control plane requires multiple servers working together, regular updates, backups, and constant monitoring. This is complicated and time-consuming to manage yourself.

With EKS, AWS runs and manages the entire control plane for you. AWS ensures it's highly available across multiple data centers, applies security patches, performs backups, and monitors its health. You don't have to worry about any of this infrastructure. What you do manage are the worker nodes, which are the servers where your containers actually run. You also manage your applications and how they're deployed. This division of responsibility means you can focus on your applications rather than maintaining Kubernetes infrastructure.

Your Three Essential Tools

Throughout this course, you'll work with three command-line tools. Each one serves a specific purpose, and understanding when to use each one will help you work more efficiently.

The aws CLI is the general-purpose tool for interacting with all AWS services. You're already familiar with this tool from previous lessons. You'll use it to manage AWS resources like IAM roles, security groups, and other infrastructure that supports your EKS cluster. For example, you might use aws to create an S3 bucket for storing application data or to configure permissions for your cluster.

The kubectl tool is the standard Kubernetes command-line interface. It works with any Kubernetes cluster, whether it's running on EKS, Google Cloud, your own servers, or even your laptop. You'll use kubectl to deploy applications, check the status of your containers, view logs, and perform day-to-day operations on your cluster. This is the tool you'll probably use most often once your cluster is running.

The eksctl tool is specifically designed for Amazon EKS. It simplifies creating and managing EKS clusters by handling many AWS-specific configurations automatically. While you could create an EKS cluster using just the aws CLI, it would require dozens of commands to set up networking, security, and other components. The eksctl tool does all of this with a single command. You'll use eksctl primarily when creating, updating, or deleting your EKS clusters.

A Note About Versions

The version numbers you see in this course (Kubernetes 1.29, eksctl 0.156.0) are examples and may differ from what's currently installed in your environment or supported by AWS. This is completely normal and expected.

Kubernetes versions: EKS typically supports the latest 3-4 minor versions of Kubernetes. Before creating any cluster, always verify which versions are currently supported. You can check in two ways:

Option 1: AWS CLI Command

aws eks describe-addon-versions \
  --query 'addons[0].addonVersions[*].compatibilities[*].clusterVersion' \
  --output text | tr '\t' '\n' | sort -u
  • describe-addon-versions: Retrieves information about EKS add-ons, which includes the specific Kubernetes versions they are compatible with.
  • --query: Uses JMESPath to navigate the complex JSON response and extract only the clusterVersion fields.
  • tr '\t' '\n': A shell utility that converts the tab-separated output into a vertical list for better readability.
  • sort -u: Sorts the version numbers and removes duplicates so you see a clean list of unique supported versions.

Option 2: Official Documentation Visit the Amazon EKS Kubernetes versions documentation for the official support matrix.

Version Selection Best Practice:

  • Use the second-newest supported version for stability
  • Always quote versions as strings in YAML: "1.29" not 1.29
  • If examples use an unsupported version, substitute any currently supported version

eksctl versions: The eksctl tool is actively developed and releases frequently. You can check for the latest version at the eksctl releases page or by running eksctl version.

Using different versions: The commands and concepts taught in this course work across Kubernetes and eksctl versions. If your versions differ slightly from the examples, the core workflows remain the same.

Understanding kubectl

The kubectl tool is your primary interface for working with Kubernetes. It communicates with the Kubernetes control plane to execute commands and retrieve information about your cluster. Understanding how kubectl works will help you manage your applications effectively.

When you run a kubectl command, it sends an API request to the Kubernetes control plane. The control plane processes the request and returns the results. For example, when you deploy an application, kubectl sends the deployment configuration to the control plane, which then schedules the containers to run on appropriate worker nodes.

The kubectl tool uses a configuration file (typically located at ~/.kube/config) to know which cluster to connect to and how to authenticate. When you create an EKS cluster, this configuration file is automatically updated with the connection details. This means you can manage multiple Kubernetes clusters by switching between different configurations.

You can check the version of kubectl installed in your environment:

kubectl version --client=true --output=yaml

The --client=true flag tells kubectl to only check the client version without trying to connect to a cluster, since you haven't created one yet. The --output=yaml flag formats the output in a readable structure:

clientVersion:
  buildDate: "2023-08-24T11:22:25Z"
  compiler: gc
  gitCommit: 89a4ea3e1e4ddd7f7572286090359983e0387b2f
  gitTreeState: clean
  gitVersion: v1.28.1
  goVersion: go1.20.7
  major: "1"
  minor: "28"
  platform: linux/amd64
kustomizeVersion: v5.0.4-0.20230601165947-6ce0bf390ce3

This output shows detailed version information about your kubectl installation. The kubectl tool also provides extensive help documentation:

kubectl help

This displays a list of all kubectl commands with brief descriptions. Getting comfortable with the help command is valuable because it provides quick reference information without needing to search online documentation.

Understanding eksctl

The eksctl tool was created by Weaveworks in collaboration with AWS to simplify EKS cluster management. It abstracts away much of the complexity involved in setting up an EKS cluster by handling AWS-specific configurations automatically.

When you create a cluster with eksctl, it performs numerous operations behind the scenes. It creates a VPC (Virtual Private Cloud) with appropriate subnets, sets up security groups, creates IAM roles with the correct permissions, launches the EKS control plane, and provisions worker nodes. Doing all of this manually with the aws CLI would require dozens of commands and careful coordination.

The eksctl tool also integrates with CloudFormation, AWS's infrastructure-as-code service. This means all the resources it creates are tracked and can be updated or deleted as a group. This makes cluster management much more reliable and predictable.

You can check the version of eksctl:

eksctl version

This displays a simple version number:

0.156.0

And explore available commands:

eksctl help

This shows the available eksctl commands and options. Throughout this course, you'll use eksctl to create, configure, and manage your EKS clusters.

How the Tools Work Together

Understanding how these three tools complement each other will help you work more efficiently. Each tool has its own domain of responsibility, and knowing which tool to use for each task is an important skill.

You'll use aws for general AWS infrastructure tasks that aren't specific to Kubernetes. This includes managing IAM policies, creating S3 buckets, configuring CloudWatch logs, and other AWS services that support your applications.

You'll use eksctl for cluster-level operations. This includes creating new clusters, adding or removing node groups (groups of worker nodes), updating cluster configurations, and deleting clusters. The eksctl tool handles the AWS-specific aspects of these operations.

You'll use kubectl for application-level operations within your cluster. This includes deploying applications, scaling deployments, viewing logs, executing commands in containers, and managing Kubernetes resources like services and ingresses. Once your cluster is running, kubectl is the tool you'll use most frequently.

For example, a typical workflow might look like this: First, you use eksctl to create a new EKS cluster. Then, you use kubectl to deploy your application to the cluster. If your application needs to store data in S3, you use aws to create the bucket and configure permissions. If you need to scale your cluster by adding more worker nodes, you use eksctl. If you need to scale your application by running more container replicas, you use kubectl.

Summary and What's Next

In this lesson, you learned that Kubernetes is a container orchestrator that automates the deployment, scaling, and management of containerized applications. Amazon EKS is AWS's managed Kubernetes service that handles the complex control plane for you, allowing you to focus on running your applications rather than managing Kubernetes infrastructure.

You were introduced to three essential command-line tools: aws for general AWS operations, kubectl for Kubernetes operations, and eksctl for EKS-specific cluster management. You learned how each tool serves a specific purpose and how they work together to provide a complete solution for managing containerized applications on AWS.

In the upcoming practice exercises, you'll verify these tools are working in your environment and explore their help documentation. After that, you'll be ready to create your first EKS cluster and start deploying containers. The foundation you've built in this lesson will support everything you do throughout the rest of this course.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal