19 EKS-Cluster
19 EKS-Cluster
Introduction:
EKS cluster is provided by AWS as a PAAS service.
Objective:
1. Create an EKS cluster
Step 1:
Above we are providing it a role Clusterrole which is having the below permission.
AmazonEKSClusterPolicy : IAM role to allow the Kubernetes control plane to
manage AWS resources on your behalf.
Public
The cluster endpoint is accessible from outside of your VPC. Worker node traffic will
leave your VPC to connect to the endpoint.
Public and private
The cluster endpoint is accessible from outside of your VPC. Worker node traffic to
the endpoint will stay within your VPC.
Private
The cluster endpoint is only accessible through your VPC. Worker node traffic to the
endpoint will stay within your VPC.
Above we have the logging option, we are keeping everything default and click Next.
Now AWS will install EKS add-ons which will be used for the networking part. These add-ons
are.
1. Kube-proxy
2. CoreDNS
3. Amazon VPC CNI
Click Next and it will ask for the versions for add-ons. We are keeping it default and click
Next.
Next page will ask us to review and create. Go ahead and wait for our cluster.
Now our cluster is in active mode, we need to add nodes to it.
Below we have given a name workers to our node group and also a role has been assigned
to it.
The role we have assigned is having three permission required cluster formation.
This policy allows Amazon EKS worker nodes to connect to Amazon EKS
AmazonEKSWorkerNodePolicy
Clusters.
AmazonEC2ContainerRegistryReadOnly Provides read-only access to Amazon EC2 Container Registry repositories.
This policy provides the Amazon VPC CNI Plugin (amazon-vpc-cni-k8s) the
permissions it requires to modify the IP address configuration on your EKS
AmazonEKS_CNI_Policy
worker nodes. This permission set allows the CNI to list, describe, and
modify Elastic Network Interfaces on your behalf.
We are using the same subnets which are a part of our default VPC.
Click Next, further click Review and Create.
Now our cluster is completely ready and worker nodes are active too.
Step3: Access the cluster
Now we will be accessing the cluster from our machine. We need below packages as
prerequisites.
1. AWS Installation
2. Kubectl Installation
3. Update kubeconfig file
1. AWS Installation:
unzip awscliv2.zip
sudo ./aws/install
Once the AWS installation is down, we can check the status using below command.
aws –version
Now further configure aws using aws configure command. Also use AWS access Key
ID and AWS Secret Access Key to configure it.
2. Kubectl Installation:
Download the kubectl binary for your cluster's Kubernetes version from Amazon S3
curl -O
https://s3.us-west-2.amazonaws.com/amazon-eks/1.21.14/2022-10-31/bin/
linux/amd64/kubectl
chmod +x ./kubectl
Copy the binary to a folder in your PATH. If you have already installed a version of
kubectl, then we recommend creating a $HOME/bin/kubectl and ensuring that
$HOME/bin comes first in your $PATH.
Now our last step is to update the kubeconfig file in order to access the cluster.
Use the below command.