I am trying to setup kubernetes master with ansible and one of the task showing . . .

Marko Eremija:
Not sure if that is the issue, but are you sure you have switched to the correct user, i.e., gkalesha ?

Kalesha Gagguturu:
yes i have switched to same user and also with root user as well we are getting similar error

Kalesha Gagguturu:
basically kubernetes initialization is not working
As per AI inputs now I am trying to install docker and containerd packages

Kalesha Gagguturu:
And trying to pull them with docker repo instead of centos repo

unnivkn:
Hi @Kalesha Gagguturu please go through this:
https://computingforgeeks.com/deploy-kubernetes-cluster-on-ubuntu-with-kubeadm/

Kalesha Gagguturu:
@unnivkn This configuration is for Ubuntu machine and where as I am trying for Centos 7 and not able to install contained and docker-ce on centos 7
It says Could not resolve host http://download.docker.com|download.docker.com

Al West:
Have you been doing anything with SELinux? Maybe turn that off and try.

Kalesha Gagguturu:
I did the same

Kalesha Gagguturu:
SELinux disabled already

Al West:
If you disable the Docker repo are you able to complete a yum update?

unnivkn:
Hi @Kalesha Gagguturu please follow these 2-links line by line and go through the redHat based distributions.
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/

Al West:
I was able to add the Docker CE repo on Centos 7.9:

sudo yum-config-manager --add-repo <https://download.docker.com/linux/centos/docker-ce.repo>

If it does not work for you and DNS is working you have some kind of network problem.

Kalesha Gagguturu:
Ah finally
Now trying with playbook

Kalesha Gagguturu:

Al West:
So what was the fix?

Kalesha Gagguturu:
Looks like network issue or some configuration issues as I followed many things on google and discussion forums. Something like disabling ipv6 or something.

But before starting this configuration I had created snapshots. So reverted my virtual machines to initial configuration and restarted my laptop.

After that first I had disabled selinux, restarted my laptop.
Then added google dns at /etc/resolv.conf and after that added the repo manually

These two steps I did manually and removed from my playbook. Then started installing dependencies

Kalesha Gagguturu:
Right now installing kubelet using playbook

Kalesha Gagguturu:
Need to whether this time kubernetes cluster will initialise properly or not

Kalesha Gagguturu:
@unnivkn @Al West
Thanks for your previous inputs and i was able to deploy the cluster with ansible playbooks with some modifications and newer versions.
After that i found if I am restarting my servers cluster not working and it was due to swap, so i disabled swap and now even after restart my cluster is working fine.

But from my deployment I am not able to find the cluster status as healthy. I think something missing in my configuration.
When I checked kubelet status I am having below error
Nov 27 18:04:44 kubemaster kubelet[9424]: E1127 18:04:44.746741 9424 kubelet.go:2373] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error:...n not initialized"
And when i check the cluster status all 3 nodes are having below warning message

Type     Reason                   Age                    From             Message
  ----     ------                   ----                   ----             -------
Warning  InvalidDiskCapacity      16m                    kubelet          invalid capacity 0 on image filesystem

And when i run kubectl get nodes, the status is as follows

gkalesha@kubemaster[Sun Nov 27][06:05 PM]:~$k get nodes
NAME         STATUS     ROLES           AGE     VERSION
kubemaster   NotReady   control-plane   2d16h   v1.25.0
kubenode1    NotReady   &lt;none&gt;          2d15h   v1.25.0
kubenode2    NotReady   &lt;none&gt;          2d15h   v1.25.0

And the pods status showing as

gkalesha@kubemaster[Sun Nov 27][06:08 PM]:~$k -n kube-system get po
NAME                                 READY   STATUS    RESTARTS      AGE
coredns-565d847f94-b84g4             0/1     Pending   0             2d16h
coredns-565d847f94-c92zm             0/1     Pending   0             2d16h
etcd-kubemaster                      1/1     Running   2 (13m ago)   2d16h
kube-apiserver-kubemaster            1/1     Running   2 (13m ago)   2d16h
kube-controller-manager-kubemaster   1/1     Running   2 (13m ago)   2d16h
kube-proxy-h48gq                     1/1     Running   2 (12m ago)   2d15h
kube-proxy-s7b6n                     1/1     Running   2 (13m ago)   2d15h
kube-proxy-wt982                     1/1     Running   2 (13m ago)   2d16h
kube-scheduler-kubemaster            1/1     Running   2 (13m ago)   2d16h

Kalesha Gagguturu:
I used below configuration for network configuration with flannel

 - name: install Pod network
     become: yes
     become_user: gkalesha
     ansible.builtin.shell: kubectl apply -f <https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml> &gt;&gt; pod_network_setup.txt
     args:
        chdir: $HOME
        creates: pod_network_setup.txt

And it produced me below output

cat pod_network_setup.txt
serviceaccount/flannel created
configmap/kube-flannel-cfg created