Lab1 - Deploying The Kubernetes Cluster - Master
Lab1 - Deploying The Kubernetes Cluster - Master
Introduction
In this Lab, you will learn how to create kubernetes cluster
In the Kubernetes setup, we have one master host and two worker nodes.
From the master host, we will manage the kubernetes using the “kubeadm” and
“kubectl” command.
1 Login into Master node as root user with the password linux if not already.
2 Generate ssh key-pair to be able to have password less access to master and worker nodes
# ssh-copy-id 192.168.100.11
Output:
Type yes and enter the root password as “linux” when prompted.
# ssh-copy-id 192.168.100.12
Output:
# ssh-copy-id 192.168.100.13
Output:
SELinux has three basic modes of operation, of which Enforcing is set as the
installation default mode.
• Enforcing: The default mode which will enable and enforce the SELinux
security policy on the system, denying access and logging actions
• Permissive: In Permissive mode, SELinux is enabled but will not enforce
the security policy, only warn and log actions. Permissive mode is useful
for troubleshooting SELinux issues.
• Disabled: SELinux is turned off
Output:
Note: If you wish to work along with the Firewall, open kubernetes services ports by running
below commands.
firewall-cmd --permanent --add-port=6443/tcp
firewall-cmd --permanent --add-port=2379-2380/tcp
firewall-cmd --permanent --add-port=10250/tcp
firewall-cmd --permanent --add-port=10251/tcp
firewall-cmd --permanent --add-port=10252/tcp
firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd –reload
Output:
3.7 You must turn off the swap space as Kubernetes does not support it.
# swapoff -a
# modprobe br_netfilter
# sysctl --system
4 Update and Reboot the server to get the latest packages installed.
# yum update -y
# reboot
Login back to the kube-master as root user to proceed with next steps.
5.1 Let us setup the repository for docker, by executing the below commands.
# yum-config-manager --add-repo
https://download.docker.com/linux/centos/docker-ce.repo
5.2 Let us install and configure Docker, by executing the below commands.
# mkdir /etc/docker
# mkdir -p /etc/systemd/system/docker.service.d
5.3 Kubernetes packages are not available in the default repositories, Use the below command
to configure its package repositories.
Output:
Output:
Output:
7 Run the below commands to set variables to be able to manage kubernetes cluste
# mkdir -p $HOME/.kube
# kubectl apply -f
https://docs.projectcalico.org/manifests/calico.yaml
Output:
8 A node taint lets you mark a node so that the scheduler avoids or prevents using it for
certain Pods. A complementary feature, toleration, lets you designate Pods that can be used
on “tainted” nodes.
NoSchedule: Pods that do not tolerate this taint are not scheduled on the node.
PreferNoSchedule: Kubernetes avoids scheduling Pods that do not tolerate this taint onto the
node.
NoExecute: Pod is evicted from the node if it is already running on the node, and is not
scheduled onto the node if it is not yet running on the node.
# kubectl cluster-info
Output: