How to change kube-proxy config?

Viewed 4203

I've tried to change kube-proxy configMap and kube-proxy command to set metricsBindAddress but kubernetes resets these changes(without any warnings) after couple seconds.

  1. kubectl edit cm kube-proxy-config -n kube-system => add metricsBindAddress => wait couple seconds and open the config - there is empty metricsBindAddress
  2. kubectl edit ds kube-proxy -n kube-system => add --metrics-bind-address to command => wait couple seconds => the command was reset to default

How to change kube-proxy config and keep these changes ?

Kubernetes version 1.17

UPDATE(as you can, after several seconds metricsBindAddress was changed to empty string): enter image description here

UPDATE 2(pay attention on metricsBinAddress, it's changed after ~40-50 seconds): enter image description here

FINAL UPDATE: Answer from cloud provider(Yandex) - kube-proxy pod it is on the host's network, so to prevent security problems, it listens exclusively on the loopback address and therefore the parameter will be reset

p.s. https://github.com/helm/charts/tree/master/stable/prometheus-operator#kubeproxy - I want to make kube-proxy accessible by prometheus

2 Answers

First edit:

kubectl edit cm/kube-proxy -n kube-system

.....
metricsBindAddress: 0.0.0.0:10249
.....

Then,

kubectl rollout restart ds kube-proxy -n kube-system

You have to restart the pods otherwise they do not get the configuration. You can check the status by:

kubectl rollout status ds kube-proxy -n kube-system

I am posting this Community Wiki because root cause of the issue has been determined.

Usually to change of metricsBindAddress: can be achieved by editing ConfigMap and delete kube-proxy pod or use rollout restart on DaemonSet.

Root cause of this issue was that this change was blocked by OP's environment - Yandex Cloud.

OP received feedback from Yandex Support

kube-proxy pod it is on the host's network, so to prevent security problems, it listens exclusively on the loopback address and therefore the parameter will be reset

Related