How to install kubernetes on aws ec2 instance

Table of Contents

  1. The Basic tools used for Kubernetes installation
    1. Kubeadm
    2. Kubelet
    3. Kubectl
  2. The basic layout structure of nodes presents in the Kubernetes structure
  3. Steps for the Kubernetes installation
    1. Creating a fresh EC2 instance
    2. Installing all the dependencies and provisions
    3. Install the KUBEADM
    4. Make the AMI of the instance
    5. Create another instance of EC2 with the same AMI and make them worker node
  4. Video Tutorial ( 2 videos )

1.Basic tools used for Kubernetes installation 

Kubernetes is an open-source tool used for orchestration of the containerized application and there are three major tools used for the installation of Kubernetes. which are

a. Kubeadm

kubeadm is using to create a master node in the Kubernetes and nodes

Automates the installation: The kubeadm has in the process of automating the installation Oftools in the Kubernetes

It also Automation the configuration of Kubernetes components. e.g.

  1. API Server
  2. Controller Manager
  3. Kube DNS
  4. Nodes are the collection of containers. So, the collections of containers comprised a node and there is a master node in Kubernetes which controls the other syllabi node on the structure

example :

So, let us say there are three nodes present in a Kubernetes network then, one should be a master node it will be controlling Itself and the other tool is the syllabi node. So, the kubeadm is using to create a master node.

b. Kubelet

The Kubelet is used to manage processes happening on all the nodes.

c. Kubectl

And the kubectl tool is used to communicate the nodes with each other. So, the kubectl tools perform the function of communications between the nodes.

2. The basic layout structure of nodes presents in the Kubernetes structure

Figure-1
  1. Now talking about the basic layout structure of the nodes present in a Kubernetes structure. First is a master node and there are three-layer nodes present here. Node1, Node2, Node3. And all these the processes again on these notes managed by that tool.
  2. If we talking in detail about Node1. So, there is a weave operation going on in node1 as well as a proxy operation. which also going on node2 and node3. So, using the kubectl tool the masters able to communicate with node1, node 2, node3 simultaneously. and the master node must have all the functionalities of the other same nodes that are the reason the master node is having a proxy as well as v functionality.

3. Steps for the kubernetes installation

  1. Creating a fresh EC2 instance.
  2. Installing all the dependencies and provisions.
  3. Install KUBEADM.
  4. Make the AMI of the instance.
  5. Create another instance of EC2 with the same AMI and make them worker nodes.
  6. The command which will be using first is sudo su.
Figure-2

7. And using the get update command we will update the packages in the instances.

8. The third command which we will be using is app cat install -y apt-transport-https. It is used to out the traffic which is incoming on the instance of two different nodes.

Figure-3

9. Using the fourth command which we will be installed in the package Kubernetes package.

Figure-4

11. Now we have to define some Kubernetes lists. We again update all the packages present in the instance.

Figure-5

12. After that we will install docker.io, we will install that docker.io

Figure-6

13. Now using this command we will be installing the three major tools which are used in the structure of Kubernetes which are kubelet, kubeadm, kubectl.

4. Steps for Kubernetes installation

a. Creating a fresh EC2 instance 

This is our Kubernetes here we specify the volume of the image that we want to use so it would be 30 GB and the image name could be a slave so let’s click on create an image.

Figure-7

Then

Figure-8

As you go on AMI you can see that the image is being created.

Figure-9
  1. In the AMI word, we can create the token on which we will be able to connect the slave nodes to the master node so for generating the token in the previous lecture we have covered some parts and we will initiate the cube idiom.
  2. But before that we the AMI should be working properly now from here we will launch the instance
Figure-10

Tato micro sufficient for that so here we will choose two.

Figure-11

The default will use the default security group settings here we have already saved.

Figure-12

A key pair so we will use that you so we can check the status of the two instances being launched in the ec2 instances dashboard. We can name them as we want so we will be naming them slave one and slave two.

Figure-13
  1. This comment will create the token by using that we can easily connect our slave nodes to the master node.
  2. The token creation can take up to one minute so you have to be patient for that till main while we can connect to the slave node.
Figure-14

The new slave node which we have created using the image of the master instance we will simply paste the path of the KPA file which is the PEM file and along with that, we will pass the path of the slave instance.

Figure-15

So we have to replace route and type in ubuntu here so as we have successfully launched and successfully log in to a slave node nowhere in the master node we have successfully created the token now we will paste this token here now we will able to connect this slave node to the master node.

Figure-16

We will be using the following command to make a directory in the master node so let’s copy the command and the command will give the permissions to the home directory and now using the command we can check the status of the node.

mkdir -pp $HOME/.kube

We will successfully connect the new slave node to the master node.

Figure-17

we are checking whether we have got the node or not so as you can see the master node is ready and we have just added another snap node to the scoober native structure which was added 20 seconds 37 seconds ago so depending on the size of the node it may take up to 1 to 2 minutes for the node to get ready.

Video Tutorial-1

Video Tutorial-2

Leave a Reply

Your email address will not be published. Required fields are marked *