Steps to install Kubernetes on Amazon Linux EC2

kubernetes on amazon linux ec2

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

  1. Open the AWS EC2 dashboard on the Amazon platform and select the “Instances” page from the left panel.
  2. To configure the instance, click the “Launch instances” button.
  3. Enter the instance name and select “Amazon Linux” from the “Quick Start” on the Application and OS image(Amazon Machine Image).
  4. Choose the Free tier eligible instant type and select the required key pair.
  5. Finally, check the settings and click the “Launch” button.

To Connect with EC2 Instance

  1. From the instance dashboard, choose the instance name and click the “connect” button.
  2. 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
  1. Change the path of the key pair file on the local system using the above platform’s command on the terminal.
  2. Now update the yum package by using the below command:
sudo yum update -y

To Install Prerequisites

  1. Before installing Kubernetes, install Docker:
sudo yum install -y docker
  1. Start Docker’s necessary services after installation:
sudo systemctl start docker
  1. Then enable the Docker
sudo systemctl enable docker

To  Install Kubernetes

  1. 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"
  1. 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"
  1. To validate, use the checksum, and the response “OK” indicates that the validation was successful:
echo "$(cat kubectl.sha256) kubectl" | sha256sum –check
  1. After the validation process, install the Kubernetes:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  1. Now verify the installation process:
kubectl version --client --output=yaml
  1. 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

Subscribe to get free blog content to your Inbox
Loading

Written by actsupp-r0cks