K8s Cluster Setup
SUDO Privilege's are required
Privileged access to your Ubuntu System via sudo command is required
Switch to Bash Shell
bash
Verify the SUDO Privileges
sudo apt update -y
Configure Hostname
On Master Node run the below Command
sudo hostname master
On Worker Node 1 run the below Command
sudo hostname worker1
On Worker Node 2 run the below Command
sudo hostname worker2
Clone Training files
Clone the code repository created for this training on all the master and worker Nodes
Step 1: Clone the repository
git clone https://github.com/nishanthkumarpathi/Kubernetes-Advanced-Microfocus.git
Step 2: Switch the directory to GettingStarted folder
cd "Kubernetes-Advanced-Microfocus/00GettingStarted/"
Step 3: Enable Executable permissions
chmod +x *.sh
Run the above commands on all the servers
Docker Installation - Master Node
Run the Below Command to Install Docker on master node
./docker-installation.sh
Logout from the console and login again before you go to next step
Docker Installation - Worker Nodes
Run the Below Command to Install Docker on all worker node
./docker-installation.sh
Logout from the console and login again before you go to next step
Perform Docker Login
Run the below commands to do docker login.
docker login
Proxy Configuration - Micro focus Environment
Perform all the below Proxy Configuration Operations on Master Node and Worker Node
Switch to Bash Shell
bash
Step 1: Create a systemd drop-in directory for the docker service:
sudo mkdir /etc/systemd/system/docker.service.d
Step 2: Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf
and add the HTTP_PROXY and HTTPS_PROXY environment variable.
sudo touch /etc/systemd/system/docker.service.d/http-proxy.conf
Note : Use Nano Editor for adding the below lines to the above http-proxy.conf
file. You can also use any other editor
sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://web-proxy.in.softwaregrp.net:8080/"
Environment="HTTPS_PROXY=http://web-proxy.in.softwaregrp.net:8080/"
Environment="NO_PROXY=localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16"
To Save the File use : Ctrl + X then type "y" then Enter
You need to ensure that NO_PROXY should have your local Network configured, so that local requests to your network are not forwarded to proxy, rather they are sent directly to destination system in the Network
Step 3: Create a systemd drop-in directory for the containerd service:
sudo mkdir -p /etc/systemd/system/containerd.service.d/
Step 4: Create a file called /etc/systemd/system/containerd.service.d/http-proxy.conf
and add the HTTP_PROXY and HTTPS_PROXY environment variable.
sudo touch /etc/systemd/system/containerd.service.d/http-proxy.conf
Note : Use Nano Editor for adding the below lines to the above http-proxy.conf
file. You can also use any other editor
sudo nano /etc/systemd/system/containerd.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://web-proxy.in.softwaregrp.net:8080/"
Environment="HTTPS_PROXY=http://web-proxy.in.softwaregrp.net:8080/"
Environment="NO_PROXY=localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16"
To Save the File use : Ctrl + X then type "y" then Enter
You need to ensure that NO_PROXY should have your local Network configured, so that local requests to your network are not forwarded to proxy, rather they are sent directly to destination system in the Network
Step 5: Append the Proxy Value is as below to /etc/environment
file
sudo nano /etc/environment
append the below line of configuration
export no_proxy=localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16
To Save the File use : Ctrl + X then type "y" then Enter
Step 6: use systemd as the default driver for docker.
cd ~
sudo cat > daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
sudo mv daemon.json /etc/docker/
Step 7: Flush changes
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl restart containerd
Step 8: Verify that the configuration has been loaded. Observe the Output
sudo systemctl show --property Environment docker
The above command output should return Proxy Environmental Variables that we have configured before.
Press Q to exit from the above command
If you see proxy Environmental Variables in the output, then Goto Step 9.
Step 9: Pull the Busybox Image, to verify weather docker deamon is able to download or not
perform docker login
docker login
docker pull busybox
In Case if you get a permission error. Please logout of the machine and login again.
If there is an issue, then inform Instructor.
Kubernetes Installation - Master Node Installation
Move to the cloned repository
cd "Kubernetes-Advanced-Microfocus/00GettingStarted/"
./k8s-master-containerd.sh
Please observe the output from the above command constantly till it ends.
Kubernetes Installation - Worker Nodes Installation
Move to the cloned repository
cd "Kubernetes-Advanced-Microfocus/00GettingStarted/"
You need to run these below commands on both Worker Nodes
./k8s-worker-containerd.sh
Join Worker Nodes to Master Nodes
On Master Node : Run the following Command
kubeadm token create --print-join-command
Copy the Output of the above command and run that output command on Worker Nodes.
Append "sudo" to the above command while pasting it on Worker Node.
On Worker Nodes : Run the following Command
The below is a sample command. Please use the command that you got from your Kubernetes Master Server
sudo kubeadm join ip:6443 --token XXXXXXX \
--discovery-token-ca-cert-hash \
XXXXXXXX
On Master Node : Run the Below Command
kubectl get nodes
Congrats ! If you see the list of nodes, then you have successfully configured the Kubernetes Cluster
Last updated
Was this helpful?