Skip to main content
cherala

12 months ago

Setting Up Kubernetes Master Server on Centos7

I am trying to setup Kubernetes MAster server, and i have followed all the steps setting up on Centos7, i am getting the following as "NotReady".

[user@cherala1 ~]$ kubectl get nodes

NAME STATUS ROLES AGE VERSION

cherala1.mylabserver.com NotReady master 3m37s v1.12.1

Image of cherala
cherala
12 months ago

I see this error message

Oct 26 19:31:48 cherala4.mylabserver.com kubelet[24721]: W1026 19:31:48.768988 24721 cni.go:188] Unable to update cni config: No networks found in /etc/cni/net.d

Oct 26 19:31:48 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:48.769348 24721 kubelet.go:2167] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady

Oct 26 19:31:49 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:49.092116 24721 summary_sys_containers.go:45] Failed to get system container stats for "/system.slice/kubelet.service"

Oct 26 19:31:49 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:49.092139 24721 summary_sys_containers.go:45] Failed to get system container stats for "/system.slice/docker.service":

Oct 26 19:31:53 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:53.475623 24721 pod_workers.go:186] Error syncing pod a2d9bff5-d951-11e8-9ed9-0625bbd31840 ("coredns-576cbf47c7-d6wc7_

Oct 26 19:31:53 cherala4.mylabserver.com kubelet[24721]: W1026 19:31:53.770367 24721 cni.go:188] Unable to update cni config: No networks found in /etc/cni/net.d

Oct 26 19:31:53 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:53.770490 24721 kubelet.go:2167] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady

Oct 26 19:31:54 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:54.477232 24721 pod_workers.go:186] Error syncing pod a2d7b1d3-d951-11e8-9ed9-0625bbd31840 ("coredns-576cbf47c7-rg88c_

Oct 26 19:31:55 cherala4.mylabserver.com kubelet[24721]: E1026 19:31:55.354005 24721 azure_dd.go:147] failed to get azure cloud in GetVolumeLimits, plugin.host: cherala4.mylabserver.com

Image of halex
halex
12 months ago

Did you add your Flannel CNI ?

Image of cherala
cherala
12 months ago

Here are the steps:

# swapoff -a

# vi /etc/fstab

# swapon -s

# yum -y update

# yum -y install docker

# systemctl enable docker ; systemctl start docker

# vi /etc/yum.repos.d/kubernetes.repo

# setenforce 0

# vi /etc/selinux/config

# yum install -y kubelet kubeadm kubectl vim

# systemctl enable kubelet ; systemctl start kubelet

# vi /etc/sysctl.d/k8s.conf

# sysctl --system

# kubeadm init --pod-network-cidr=10.244.0.0/16

As user on Master

[user@cherala4 ~]$ mkdir -p $HOME/.kube

[user@cherala4 ~]$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

[user@cherala4 ~]$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

[user@cherala4 ~]$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

[user@cherala4 ~]$ kubectl get pods --all-namespaces

NAMESPACE NAME READY STATUS RESTARTS AGE

kube-system coredns-576cbf47c7-595mq 0/1 ContainerCreating 0 26m

kube-system coredns-576cbf47c7-bxmfl 0/1 ContainerCreating 0 26m

kube-system etcd-cherala4.mylabserver.com 1/1 Running 1 25m

kube-system kube-apiserver-cherala4.mylabserver.com 1/1 Running 1 25m

kube-system kube-controller-manager-cherala4.mylabserver.com 1/1 Running 1 25m

kube-system kube-flannel-ds-pxw4w 0/1 Pending 0 18m

kube-system kube-flannel-ds-zr6jc 0/1 Pending 0 18m

kube-system kube-proxy-2ln5k 1/1 Running 1 26m

kube-system kube-proxy-cq4gp 1/1 Running 0 18m

kube-system kube-proxy-ttqr2 1/1 Running 0 18m

kube-system kube-scheduler-cherala4.mylabserver.com 1/1 Running 1 25m

$ kubectl get nodes

NAME STATUS ROLES AGE VERSION

cherala4.mylabserver.com NotReady master 20m v1.12.2

cherala5.mylabserver.com NotReady <none> 12m v1.12.2

cherala6.mylabserver.com NotReady <none> 12m v1.12.2

On Client side

[root@cherala5 ~]# kubeadm join 172.31.38.239:6443 --token xgaoxa.qrnmhwo9j2rov8fa --discovery-token-ca-cert-hash sha256:2e2c962562510f60a225d133045ddba8776572125ae1d77e015553da2bf9cdd

6

[preflight] running pre-flight checks

[WARNING RequiredIPVSKernelModulesAvailable]: the IPVS proxier will not be used, because the following required kernel modules are not loaded: [ip_vs ip_vs_rr ip_vs_wrr ip_vs_s

h] or no builtin kernel ipvs support: map[ip_vs:{} ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{}]

you can solve this problem with following methods:

1. Run 'modprobe -- ' to load missing kernel modules;

2. Provide the missing builtin kernel ipvs support

[discovery] Trying to connect to API Server "172.31.38.239:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.31.38.239:6443"

[discovery] Requesting info from "https://172.31.38.239:6443" again to validate TLS against the pinned public key

[discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server "172.31.38.239:6443"

[discovery] Successfully established connection with API Server "172.31.38.239:6443"

[kubelet] Downloading configuration for the kubelet from the "kubelet-config-1.12" ConfigMap in the kube-system namespace

[kubelet] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"

[kubelet] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"

[preflight] Activating the kubelet service

[tlsbootstrap] Waiting for the kubelet to perform the TLS Bootstrap...

[patchnode] Uploading the CRI Socket information "/var/run/dockershim.sock" to the Node API object "cherala5.mylabserver.com" as an annotation

This node has joined the cluster:

* Certificate signing request was sent to apiserver and a response was received.

* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the master to see this node join the cluster.

[root@cherala5 ~]#


Image of wboyd
wboyd
12 months ago
It looks like you haven't added networking (flannel) yet. It's normal for the node to be NotReady until you add that. It looks like everything is OK to me. You just want to make sure the node appears when you do the kubectl get nodes, it's OK at this point for it to be NotReady.

It should change to Ready once you install networking, which might be a bit later in the course.
Image of cherala
cherala
12 months ago

Thanks for your reply.

But i have already run this below command on Master as user.

Do i need to run any other command? i followed as shown in Raw kubernetes install -- centOS (CKA)

[user@cherala4 ~]$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

Image of viccab
viccab
12 months ago
Run, 

kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

to uninstall this version. 

Then run, 
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

to install the updated version.

Will, I think this info about the updated flannel version has to beadded below the video (as text). Although the new version is given in the solution to the exercise, Deploying Your Cluster, students follow first what they see in the video and get stuck on this issue. 
Deploying Your Cluster
https://linuxacademy.com/cp/exercises/view/id/670/module/155


Image of wboyd
wboyd
12 months ago
Victor is correct, the newest Kubernetes version doesn't like the old flannel 0.9.1 install yaml. I won't bore you with the details, but Victor's solution should work!

I'll ask about updating the text below the video for the future!