0
0
AWScloud~5 mins

Why managed Kubernetes matters in AWS - Why It Works

Choose your learning style9 modes available
Introduction
Running Kubernetes on your own means handling complex setup and maintenance. Managed Kubernetes services simplify this by taking care of the hard parts, so you can focus on your apps.
When you want to deploy containerized apps without managing the underlying servers.
When you need automatic updates and security patches for your Kubernetes cluster.
When you want to scale your app easily without worrying about infrastructure details.
When you want to reduce the time spent on cluster setup and maintenance.
When you want built-in integration with cloud services like load balancers and storage.
Commands
This command creates a managed Kubernetes cluster named example-cluster in AWS EKS. It sets up the cluster with the specified IAM role and network settings.
Terminal
aws eks create-cluster --name example-cluster --region us-east-1 --role-arn arn:aws:iam::123456789012:role/EKSClusterRole --resources-vpc-config subnetIds=subnet-abc123,subnet-def456,securityGroupIds=sg-0123456789abcdef0
Expected OutputExpected
{ "cluster": { "name": "example-cluster", "arn": "arn:aws:eks:us-east-1:123456789012:cluster/example-cluster", "createdAt": "2024-06-01T12:00:00Z", "version": "1.27", "endpoint": "https://EXAMPLE.gr7.us-east-1.eks.amazonaws.com", "roleArn": "arn:aws:iam::123456789012:role/EKSClusterRole", "resourcesVpcConfig": { "subnetIds": [ "subnet-abc123", "subnet-def456" ], "securityGroupIds": [ "sg-0123456789abcdef0" ], "endpointPublicAccess": true }, "status": "CREATING" } }
--name - Sets the name of the Kubernetes cluster
--region - Specifies the AWS region to create the cluster in
--role-arn - Defines the IAM role for cluster permissions
This command waits until the cluster status changes to active, meaning it is ready to use.
Terminal
aws eks wait cluster-active --name example-cluster --region us-east-1
Expected OutputExpected
No output (command runs silently)
--name - Specifies the cluster to wait for
--region - Specifies the AWS region of the cluster
This command updates your local Kubernetes configuration to connect to the new EKS cluster, so you can run kubectl commands.
Terminal
aws eks update-kubeconfig --name example-cluster --region us-east-1
Expected OutputExpected
Added new context arn:aws:eks:us-east-1:123456789012:cluster/example-cluster to /home/user/.kube/config
--name - Specifies the cluster to configure access for
--region - Specifies the AWS region of the cluster
This command lists the worker nodes in your Kubernetes cluster to confirm they are ready.
Terminal
kubectl get nodes
Expected OutputExpected
NAME STATUS ROLES AGE VERSION ip-192-168-1-1.us-east-1.compute.internal Ready <none> 5m v1.27.0
Key Concept

Managed Kubernetes lets you run container apps without handling the complex setup and upkeep of the cluster itself.

Common Mistakes
Trying to create a cluster without specifying the correct IAM role.
The cluster needs permissions to manage AWS resources; without the role, creation fails.
Create and specify a proper IAM role with EKS permissions before creating the cluster.
Running kubectl commands before updating kubeconfig.
kubectl won't know how to connect to the new cluster, causing errors.
Always run 'aws eks update-kubeconfig' after cluster creation to set up access.
Summary
Use 'aws eks create-cluster' to start a managed Kubernetes cluster with proper roles and network settings.
Wait for the cluster to become active before using it with 'aws eks wait cluster-active'.
Update your local Kubernetes config with 'aws eks update-kubeconfig' to connect kubectl to the cluster.
Verify the cluster nodes are ready by running 'kubectl get nodes'.