adding network flag --network-plugin=cni to kubelet

3/14/2018

Beginners question sorry for asking i searched on google how i need to add flags to my already running kubelet i have to add the flags --network-plugin=cni --network-plugin-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin

When i navigate to the /etc/systemd/system/kubelet.service.d/10-kubeadm.conf file these flags are already added to the env kubelet network args.

Is kubelet already configured with these flags or do i need to add those flag in an other file ?

PS: The reason i need to add those flags is a solution (maybe a solution i'am still debugging ) for my kubernetes problem: kubernetes pods stuck at containercreating

-- achahbar
kubernetes

1 Answer

3/14/2018

The kubelet by default comes with the flags you mentioned. If you have access to the nodes running this cluster, you can check the running kubelet process to check whether it started using the flags mentioned above using

ps -ef | grep kubelet

You would have an output similar to this

root     11841     1  3 Mar07 ?        05:46:46 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin --cluster-dns=10.96.0.10 --cluster-domain=cluster.local --authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt --cadvisor-port=0 --cgroup-driver=cgroupfs --cloud-provider=openstack --cloud-config=/etc/kubernetes/cloud-config --rotate-certificates=true --cert-dir=/var/lib/kubelet/pki

If you still want to change config , edit /etc/systemd/system/kubelet.service.d/10-kubeadm.conf file and restart kubelet for the changes to take into effect

systemctl daemon-reload
systemctl restart kubelet
-- Vijay
Source: StackOverflow