Modifying running Kubernetes deployment
I was poking around K3s single node cluster and eventually ran into some issues with metrics-server. For some reason metrics-server was not starting properly.
[root@k3sm01 ~]# kubectl get apiservices
v1.k3s.cattle.io Local True 15m
v1beta1.metrics.k8s.io kube-system/metrics-server False (MissingEndpoints) 15m
v1.crd.projectcalico.org Local True 6m32s
I found a potential solution which unfortunately, did not help. Nevertheless, I needed to try to modify metrics-server deployment. Specifically, I needed to add –kubelet-insecure-tls option. Turns out this can be done using kubectl patch command:
[root@k3sm01 ~]# kubectl patch deployment metrics-server -n kube-system --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'`
The path parameter is derived from components.yaml of metrics-server.
One can always do a re-deployment after editing the appropriate file.