#############################################################################
Step1:
We need multiple systems or VM s created for configuring multinode
cluster.
Step2:
Install container runtime engine (docker) on all the master and
worker nodes.
Step3:
Install kubeadm ( Pronounced as kubeadmin) on all the master and
worker nodes.
Step4:
Initialize the master server in the Master node.
Step5:
Make sure a POD Network connection is configured between master and
worker nodes.
Step6: Join the worker node to the master node.
#############################################################################
UBUNTU
#########
Docker Installation Commands:
https://docs.docker.com/install/linux/docker-ce/ubuntu/
Execute
the below commands in all the nodes:
# apt-get update
# sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# sudo apt-key fingerprint 0EBFCD88
#
sudo
add-apt-repository
\
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(
lsb_release
-cs)
\
stable"
#
sudo
apt-get update
#
sudo
apt-get install docker-ce docker-ce-cli containerd.io
The above command will install the docker latest version.
We
need to install the kubernetes supported version of docker inorder to
work the docker and kubernetes without any issue. Inorder to find the
supported version of docker go to the
and
search for “docker version” , you will see a line like below:
The
validated docker versions are the same as for v1.8: 1.11.2 to 1.13.1
and 17.03.x
To
install a specific
version of
Docker Engine - Community, list the available versions in the repo,
then select and install:
a.
List the versions available in your repo:
$
apt-cache madison docker-ce
docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
$
sudo
apt-get install docker-ce=
docker-ce-cli= containerd.io For example the command will be like below:
$
sudo
apt-get install docker-ce=5:18.09.1~3-0~ubuntu-xenial docker-ce-cli=5:18.09.1~3-0~ubuntu-xenial containerd.io
kubeadm
installation commands :
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
Execute the below commands in all the nodes:
#
apt-get update
&&
apt-get install -y apt-transport-https curl
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
# cat << EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
#
apt-get update
# apt-get install -y kubelet kubeadm kubectl
# apt-mark hold kubelet kubeadm kubectl
Initializing the Master:
Execute the below command in the Master node:
# kubeadm init --pod-network-cidr=10.244.0.0/16 --control-plane-endpoint=StableIP
To
make kubectl work for your non-root user, run these commands, which
are also part of the
kubeadm
init
output:#
mkdir -p
$HOME
/.kube
# sudo cp -i /etc/kubernetes/admin.conf
$HOME
/.kube/config
# sudo chown
$(
id -u
)
:
$(
id -g
)
$HOME
/.kube/config
Installing
a POD Network ADD-ON:
Execute the below command in the Master node:
#
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
Once
a pod network has been installed, you can confirm that it is working
by checking that the CoreDNS pod is Running in the output of
kubectl
get pods --all-namespaces
.
And once the CoreDNS pod is up and running, you can continue by
joining your nodes.
Join Worker Nodes to the Master:
Execute
the below command in the worker Nodes, that you got as output of
kubeadm
init
# sudo kubeadm join --token 9238u4.2348u9jo9e8ul 10.0.1.13:6443 --discovery-token-ca-cert-hash sha256:lj989sf9u8sdflljsdf98sy
After joining the nodes you will get a msg “Successfully establish
connection with the API server 10.0.1.13:6443”.
Now
you can check the status of Join by giving the below command in the
Master node:
# kubectl get nodes
# kubectl run nginx --image=nginx
# kubectl get pods -o wide # This will incldue IP and NODE of pods belogs to.
# kubectl delete deployment/nginx
##################################
####### REDHAT ##############
##################################
Comments