Hey guys do we need to run this command while upgrading the k8s Version? I neve . . .

Rajesh raj:
Hey guys do we need to run this command while upgrading the k8s Version? I never used this command in the practice labs or in the mock exam ? Do we need to login as root? ‘sudo -i’ to run the command to upgrade k8s?

cp ~/.tube/config /etc/kubernetes/admin.confl;

Prasoon Mishra:
Hi Raj, you need this cmd while installing the cluster using kubeadm…== cp /etc/kubernetes/admin.conf ~/.kube/config

Mohamed Ayman:
Yes, you can run It and If you don’t have permissions, use sudo.

Mohamed Ayman:
Check the following steps for upgrading

Mohamed Ayman:
To upgrade the master node, run

kubectl drain master/controlplane --ignore-daemonsets
apt update
apt install kubeadm=1.19.0-00
kubeadm upgrade apply v1.19.0
apt install kubelet=1.19.0-00
kubectl uncordon master

Mohamed Ayman:
To upgrade the worker nodes, run

master$ kubectl drain node01 --ignore-daemonsets
master$ ssh node01
node01$ apt update
node01$ apt install kubeadm=1.19.0-00
node01$ apt install kubelet=1.19.0-00
node01$ kubeadm upgrade node 
master$ kubectl uncordon node01

Rajesh raj:
@Mohamed Ayman we don’t need to run that command right copying kube config file? Because once we run the ‘kubeadm init’ it will gives the mkdir command which we need to copy from the output and run it right, so we don’t need to manually copy to /etc/kubernetes/admi.conf right?

Tej_Singh_Rana:
Hello, @Rajesh raj
You will get that 3 or 4 steps with command after successfully initialization of kubeadm init . Yes, at the beginning, we have to copy manually and paste as config file under the ~/.kube directory to access that cluster from respective user.

cp -v /etc/kubernetes/admin.conf ~/.kube/config

Tej_Singh_Rana:
Reference:
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#more-information

Rajesh raj:
So in the beginning we need to copy that file? I never copied this file in the udemy labs? Am little confused, from where to where we need to copy and is it mandatory to copy? @Tej_Singh_Rana