EKS cluster creation in AWS - Commands & Configuration
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: example-cluster
region: us-east-1
nodeGroups:
- name: ng-1
instanceType: t3.medium
desiredCapacity: 2
ssh:
allow: true
publicKeyName: example-key
This file defines the EKS cluster configuration using eksctl format.
- metadata.name: The cluster name.
- metadata.region: AWS region to create the cluster.
- nodeGroups: Defines worker nodes with instance type and count.
- ssh: Allows SSH access to nodes using the specified key.
eksctl create cluster -f cluster.yaml
-f - Specifies the cluster configuration file to usekubectl get nodesaws eks update-kubeconfig --name example-cluster --region us-east-1
--name - Specifies the EKS cluster name--region - Specifies the AWS region of the clusterIf you remember nothing else from this pattern, remember: eksctl simplifies EKS cluster creation by automating control plane and node setup with a simple config file.
Practice
What is the main purpose of creating an Amazon EKS cluster?
Solution
Step 1: Understand EKS cluster purpose
Amazon EKS is a managed Kubernetes service that lets you run containerized applications without managing servers.Step 2: Compare options
Options A, B, and D describe other AWS services or functions unrelated to EKS clusters.Final Answer:
To run Kubernetes applications without managing the underlying servers -> Option BQuick Check:
EKS = Managed Kubernetes service [OK]
- Confusing EKS with EC2 virtual machines
- Thinking EKS is for data storage
- Mixing EKS with IAM user management
Which of the following is the correct AWS CLI command to create an EKS cluster named my-cluster with role ARN arn:aws:iam::123456789012:role/EKSRole and subnets subnet-abc123 and subnet-def456?
Solution
Step 1: Check AWS CLI syntax for EKS cluster creation
The correct command uses--namefor cluster name,--role-arnfor IAM role, and--resources-vpc-config subnetIds=...for subnet IDs separated by commas.Step 2: Identify correct option
aws eks create-cluster --name my-cluster --role-arn arn:aws:iam::123456789012:role/EKSRole --resources-vpc-config subnetIds=subnet-abc123,subnet-def456 matches the correct syntax exactly. Options A and D use incorrect flags (--cluster-name,--role). aws eks create-cluster --name my-cluster --role-arn arn:aws:iam::123456789012:role/EKSRole --resources-vpc-config subnetIds=subnet-abc123 subnet-def456 misses a comma between subnet IDs.Final Answer:
aws eks create-cluster --name my-cluster --role-arn arn:aws:iam::123456789012:role/EKSRole --resources-vpc-config subnetIds=subnet-abc123,subnet-def456 -> Option CQuick Check:
Correct CLI syntax = aws eks create-cluster --name my-cluster --role-arn arn:aws:iam::123456789012:role/EKSRole --resources-vpc-config subnetIds=subnet-abc123,subnet-def456 [OK]
- Using --role instead of --role-arn
- Missing commas between subnet IDs
- Using wrong flag names like --cluster-name
Given this AWS CLI command to create an EKS cluster:
aws eks create-cluster --name test-cluster --role-arn arn:aws:iam::123456789012:role/EKSRole --resources-vpc-config subnetIds=subnet-11111111,subnet-22222222,securityGroupIds=sg-12345678
What will happen after running this command?
Solution
Step 1: Understand parameters in the command
The command specifies cluster name, IAM role, subnet IDs, and security group IDs correctly using--resources-vpc-config.Step 2: Check if security groups are allowed
Security groups can be specified during cluster creation to control network access. The subnet IDs are comma-separated and valid format.Final Answer:
The clustertest-clusterwill be created using the specified subnets and security group -> Option DQuick Check:
Valid subnet and security group syntax = The clustertest-clusterwill be created using the specified subnets and security group [OK]
- Thinking security groups can't be set at creation
- Assuming only one subnet is allowed
- Confusing subnet ID format with invalid syntax
You tried to create an EKS cluster with this command:
aws eks create-cluster --name mycluster --role-arn arn:aws:iam::123456789012:role/EKSRole --resources-vpc-config subnetIds=subnet-12345 subnet-67890
The command failed. What is the most likely cause?
Solution
Step 1: Review subnetIds parameter format
The subnet IDs must be comma-separated inside thesubnetIds=value. Here, a space separates them, which is invalid syntax.Step 2: Check other parameters
The IAM role ARN format looks correct, cluster name is valid, and subnets in different zones are recommended, not an error.Final Answer:
Missing comma between subnet IDs insubnetIdsparameter -> Option AQuick Check:
Comma separates subnet IDs [OK]
- Using spaces instead of commas between subnet IDs
- Assuming cluster name rules cause failure
- Confusing subnet zones with errors
You want to create a highly available EKS cluster. Which setup is best practice for the network configuration?
- Use a single subnet in one availability zone
- Use multiple subnets in different availability zones
- Use only public subnets
- Use subnets without any security groups
Solution
Step 1: Understand high availability in EKS
High availability means the cluster stays up even if one zone fails. Using multiple subnets in different availability zones achieves this.Step 2: Evaluate other options
Single subnet risks zone failure. Only public subnets expose resources unnecessarily. Subnets without security groups lack network protection.Final Answer:
Use multiple subnets in different availability zones -> Option AQuick Check:
Multi-AZ subnets = High availability [OK]
- Using only one subnet risking downtime
- Exposing cluster on public subnets unnecessarily
- Ignoring security groups for network safety
Ready to prove it?
Pass the test and this pattern moves unknown
