2. Kubernetes Cluster set up

Опубликовано: 19 Ноябрь 2024
на канале: iMustLearn
124
1

Kubernetes Cluster set up
Step 1: Add docker gpg key.
curl -fsSL https://download.docker.com/linux/ubu... | sudo apt-key add -

Step 2: add docker repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Step 3: update the packages
sudo apt-get update

Step 4: Install docker.
sudo apt-get install -y docker-ce [docker-ce=18.06.1~ce~3-0~ubuntu]

Step 5: Check the installed Docker version
docker version

Step 6: Check the status of the Docker
sudo systemctl status docker

Step 7: Hold the docker-ce at the current version
sudo apt-mark hold docker-ce

Step 8: Install Kubernetes components.
Get the Kubernetes GPG key and repo:
curl -s https://packages.cloud.google.com/apt... | sudo apt-key add -

Step 9: Add the kubernetes repository
cat EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

Step 10: update the packages.
sudo apt-get update

Step 11: Install Kubelet, Kubeadm and Kubectl
sudo apt-get install -y kubelet=1.18.5-00 kubeadm=1.18.5-00 kubectl=1.18.5-00

Step 12: Check the installed Kubernetes version
kubectl version --short

Step 13: Hold the kubelet kubeadm kubectl at the current version
sudo apt-mark hold kubelet kubeadm kubectl

Step 14: Bootstrap the Kubernetes cluster. (Master)
Run this command only on Master node.
sudo kubeadm init --pod-network-cidr=10.244.0.0/16

Step 15: Set-up local kubeconfig: (Master)
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Step 16: Join the Kube worker node to the cluster. (Worker)
sudo kubeadm join token...

Step 17: (Master)
kubectl get node
(Status is NotReady)

Step 18: Turn on iptables bridge calls (on all nodes)
echo "net.bridge.bridge-nf-call-iptables=1" | sudo tee -a /etc/sysctl.conf

Step 19: To apply iptable bridge call change immediately
sudo sysctl -p

Step 20: Apply Flannel overlay network (Master)
kubectl apply -f https://raw.githubusercontent.com/cor...

Step 21: Check worked node joined cluster or not
##kubectl get nodes

kubectl cluster-info

#kubectl# config view