How Do You Install Kubernetes on an AWS Instance of RedHat Linux?

Problem scenario:  You are using RHEL 7.x via AWS.  You want to install Kubernetes.  What do you do?

Solution
1.  Log into the Linux server as ec2-user.  Then run this command:
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

2.  Create this file: /etc/yum.repos.d/kubernetes.repo
3.  Have this be the content of the file (with the first line being "[kubernetes]" and the last line ending in "...rpm-package-key.gpg":

[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

4.  Run these two commands:
sudo setenforce 0
sudo yum -y install docker kubelet kubeadm kubectl kubernetes-cni

5.  Run this command as a test:  kubeadm version

6.  Then run these commands also as root:

sudo systemctl enable docker && sudo systemctl start docker
sudo systemctl enable kubelet && sudo systemctl start kubelet

The kubernetes.repo file and several commands above were based off these directions.

7.  Test your installation by running this command:
kubectl version --client

Leave a comment

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