Skip to content

devclosre/task-two

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Task2: Create an EKS cluster using Terraform and deploy an Nginx application on the K8s cluster and access it via the Internet

We are using AWS as our cloud provider for this taks. Manifest files used to achieve this task: image

Once we do a terraform apply on these files, an EKS cluster, a Node group with 2 instance and a Bastion host gets created.

Lets look at the EKS cluster and Node group:

EKS is a Managed service by AWS and we do not have any control over this component, AWS has compelete control over it.

We have to create a Master Role and Node group Role and attach some policies for each role.

Policies assigned to Master Role:

AmazonEKSClusterPolicy

AmazonEKSServicePolicy

AmazonEKSVPCResourceController

Policies assigned to Node Role:

AmazonEKSWorkerNodePolicy

AmazonEKS_CNI_Policy

AmazonSSMManagedInstanceCore

AmazonEC2ContainerRegistryReadOnly

s3

EKS cluster is dependent on the Master Role with above mentioned polices and Node group is dependent on the Worker Node Role with above mentioned policies attached.

We can see the EKS cluster name is EKS-DEMO and status is Active.

image

Now we have Node Group, which is considered as Data plane and we have control over it. Actual workloads run on these machines.

image

We have two machines in the our Node group

Node1:

image

Node2:

image

Once the cluster gets created login to Bastion, we have already installed AWS CLI and kubectl using script.

image

Now we need to fetch the kubeconfig file using the below command:

aws eks update-kubeconfig --name EKS-DEMO --region ap-southeast-4

image

Now the kubeconfig file is downloaded using which we can access the API server.

kubeconfig file has all the details of the cluster, certificates and secret token to authenticate to cluster.

Using kubectl we can deploy our application on to the k8s cluster.

We have two deployment files, one for nginx deployment and one for nginx service.

The files are as follows:

image

image

Once we apply these files, Nginx deployment with 2 replicas and Nginx service of type Load Balancer gets created.

image

image

We can access our Nginx pod using the dns name of the Load Balancer.

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published