By Anushka Arora, The force behind the content that one sees on Devtron loves sharing her knowledge with people
What Is EKSCTL?
EKSCTL almost automates much of our experience of creating the EKS Cluster. EKSCTL is written in Go and makes use of AWS service, CloudFormation. It is the official CLI for Amazon EKS. The current version of eksctl allows you to create several clusters, list those, and delete them as well.
Amazon Production Grade EKS Cluster with One Command:
When we look at creating a Production grade EKS Cluster, we can create an EKS Cluster with the following command: eksctl create a cluster
When you run the above command, the following things happen:
- Sets up the AWS Identity and Access Management(IAM ) Role for the master plan to connect to EKS.
- Creates the Amazon VPC architecture and the master control plane.
- It brings up instances and deploys the ConfigMap so nodes can join the cluster.
- Provides access to the cluster with a pre-defined kubeconfig file.
Create Production Grade EKS CLuster: Using Config Files
You can create a Production Grade EKS Cluster using the Config File. Following are the steps:
First, attach the following AWS Managed Policies for a role/user / group required for creating an EKS Cluster using EKSCTL
- AmazonEC2FullAccess
- IAMFullAccess
- AmazonVPCFullAccess
- AWSCloudFormationFullAccess.
Second, Create a Cluster.yaml file
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: dt-prod-cluster
region: ap-southeast-1
vpc:
id: "vpc-1c174erf"
cidr: "12.0.0.0/16"
subnets:
private:
ap-southeast-1a:
id: "subnet-06cc7"
cidr: "12.0.112.0/24"
ap-southeast-1b:
id: "subnet-099e9"
cidr: "12.0.111.0/24"
ap-southeast-1c:
id: "subnet-099e9"
cidr: "12.0.111.0/24"
public:
prod-sg-pub-snet-1a:
id: "subnet-02825"
cidr: "12.0.32.128/25"
prod-sg-pub-snet-1b:
id: "subnet-0b065"
cidr: "12.0.32.0/25"
prod-sg-pub-snet-1c:
id: "subnet-0b065"
cidr: "12.0.32.0/25"
nodeGroups:
- name: ng-1
privateNetworking: true
instanceType:
desiredCapacity: 1
minSize: 1
maxSize: 5
instancesDistribution:
maxPrice: 0.05
instanceTypes: ["r4.large", "r3.large"] # At least two instance types should be specified
onDemandBaseCapacity: 0
onDemandPercentageAboveBaseCapacity: 50
iam:
withAddonPolicies:
autoScaler: true
attachPolicyARNs:
- arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy
- arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy
- arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess
- arn:aws:iam::aws:policy/AmazonS3FullAccess
ssh:
allow: true
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpzpEdCL7RCLjgl8YDndRbIdy2Qp7AMZGcJ2//92rjt6dlfnrafqUEr+lsQwKxrUSUAHXFKM6M5RUSoeV5LIpAP0B7sAzvER9JgsukgQJVtEGFQrkpv7IMobscUIX3NfnwVw5V0ghjhjdskjhkskfgAqinQmt2FaZtZGd+0obA1l7AOOHJG1B/IGm2k81+0xMnwOzs1UyYVnA7v4FQDpnUqE03Eh//cASqfUxfq5zJJBuHBmEsPTc1dtrklnvdj5YKSdQEWF4q6uhZXVIIhvh08WPxa3je5U3n+iie65Mf"
Properties:
Properties:
OnDemandPercentageBaseCapacity: The minimum amount of the Auto Scaling group’s capacity that On-Demand Instances must fulfill. The default value is 0; in this, On-Demand Instances are launched as a percentage of the Auto Scaling group’s desired capacity per the onDemandPercentageAboveBaseCapacity setting.
OnDemandPercentageAboveBaseCapacity: Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond onDemandPercentageBaseCapacity. The range is 0–100. The default value is 100. Here, this property is set to 50; the percentages are 50% for your additional capacity above base capacity.
vpc and subnets: If you don’t define these two properties, AWS will automatically create vpc and subnets and assign them with their respective id’s.
attachPolicyARNs: Attaches the specified managed policy to the specified IAM role. Here, you will have to define custom policies and managed policies because policies are explicitly defined; if you decide to leave it blank, AWS will implicitly attach its own policies for creating an EKS Cluster.
Next, run this command to create an EKS cluster using your yaml file: eksctl create a cluster -f cluster.yaml
That’s it! Your Production Grade EKS CLuster is ready. For eksctl documentation, check the following link: https://eksctl.io/introduction/getting-started/.
Originally published at https://devtron.ai on March 12, 2020.