Kubernetes is an open-source that allows you to manage containerized apps everywhere without changing the operational method. With Kubernetes, you can manage any application across multiple cloud or on-premises. AWS makes it easy to use Kubernetes. Here, you can manage Kubernetes by yourself using Amazon EC2.
Before installing Kubernetes on Amazon Linux EC2, you must create and connect with an EC2 instance. Then install the Docker container and Kubernetes and verify the process. So now let us see the prerequisites to install Kubernetes.
To Create an EC2 Instance
- Open the AWS EC2 dashboard on the Amazon platform and select the “Instances” page from the left panel.
- To configure the instance, click the “Launch instances” button.
- Enter the instance name and select “Amazon Linux” from the “Quick Start” on the Application and OS image(Amazon Machine Image).
- Choose the Free tier eligible instant type and select the required key pair.
- Finally, check the settings and click the “Launch” button.
To Connect with EC2 Instance
- From the instance dashboard, choose the instance name and click the “connect” button.
- Then copy the command line from the SSH Client
ssh -i “PKPF.pem” ec2-user@ec2-13-229-224-106.ap-southeast-1.compute.amazonaws.com
- Change the path of the key pair file on the local system using the above platform’s command on the terminal.
- Now update the yum package by using the below command:
sudo yum update -y
To Install Prerequisites
- Before installing Kubernetes, install Docker:
sudo yum install -y docker
- Start Docker’s necessary services after installation:
sudo systemctl start docker
- Then enable the Docker
sudo systemctl enable docker
To Install Kubernetes
- First download the most recent version from the official website:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubestl"
- Next, install the kubectl checksum to validate the downloaded version:
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
- To validate, use the checksum, and the response “OK” indicates that the validation was successful:
echo "$(cat kubectl.sha256) kubectl" | sha256sum –check
- After the validation process, install the Kubernetes:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- Now verify the installation process:
kubectl version --client --output=yaml
- Run the above command to know the currently installed version of the kubectl and the Kubernetes is installed successfully on Amazon Linux EC2.
To get more updates you can follow us on Facebook, Twitter, LinkedIn