Can someone correct me, when I check the kube-proxy logs , it is the wrong file . . .

Zxc:
Can someone correct me, when I check the kube-proxy logs , it is the wrong file that is stopping the pod kube-proxy pod? However, when I check config-map, it shows var/lib/kube-proxy/kubeconfig.conf. Why do we need to change the file in Kube-proxy DaemonSets in /var/lib/kube-proxy/config.conf that has a different path from configmap?

Alistair Mackay:
Hi @Zxc
Which lab is this? (link please)

Zxc:
hello @Alistair Mackay https://kodekloud.com/topic/practice-test-troubleshoot-network-2/

Alistair Mackay:
Hi @Zxc

This is how you solve it.

Get into kube-system namespace to make remaining commands shorter

kubectl config set-context --current --namespace kube-system

Find out why kube-proxy isn’t starting

kubectl logs kube-proxy-XXXXX

Notice it can’t load the config file

Inspect the pods definition

kubectl get pod kube-proxy-XXXXX -o yaml

Notice the volume setup

    volumeMounts:
    - mountPath: /var/lib/kube-proxy
      name: kube-proxy


volumes:
  - configMap:
      defaultMode: 420
      name: kube-proxy

We see that the the path /var/lib/kube-proxy refers to a config map, thus the config file itself is provided by the config map

Inspect the config map

kubectl get configmap kube-proxy -o yaml

Note the key name for the configuration in the data section. The key name becomes the file name when the config map is mounted as a volume.

apiVersion: v1
data:
  config.conf: |-
    apiVersion: <http://kubeproxy.config.k8s.io/v1alpha1|kubeproxy.config.k8s.io/v1alpha1>

The key name is config.conf

Thus the correct path for the configuration that kube-proxy wants is var/lib/kube-proxy/config.conf

Correct kube-proxy

kubectl edit daemonset kube-proxy

Edit the - --config= line to the correct path, save and exit

Then wait for the pod to be running.

Zxc:
Thanks @Alistair Mackay