I've accidently deleted kube-proxy from my k3s cluster. How can I restore it? Any object type is non-existent anymore, this command gives an empty result:
kubectl get all --all-namespaces | grep prox
Initiatlly, I've installed that cluster via arkade / k3sup, using k3sup install --ip $SERVER_IP --user $K3SUPUSER
kubectl cluster-info
Kubernetes control plane is running at https://192.168.22.101:6443
CoreDNS is running at https://192.168.22.101:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://192.168.22.101:6443/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
kubectl get node
NAME STATUS ROLES AGE VERSION
ras1 Ready control-plane,master 407d v1.22.7 k3s1
nuc2 Ready <none> 407d v1.22.7 k3s1
nuc1 Ready <none> 407d v1.22.7 k3s1
nuc0 Ready <none> 407d v1.22.7 k3s1
ras7 Ready <none> 379d v1.22.7 k3s1
ras3 Ready <none> 407d v1.22.7 k3s1
ras0 Ready <none> 21m v1.22.7 k3s1
ras8 Ready <none> 379d v1.22.7 k3s1
ras5 Ready <none> 407d v1.22.7 k3s1
ras9 Ready <none> 379d v1.22.7 k3s1
ras4 Ready <none> 407d v1.22.7 k3s1
ras2 Ready <none> 407d v1.22.7 k3s1
ras6 Ready <none> 407d v1.22.7 k3s1
kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:38:05Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.7 k3s1", GitCommit:"8432d7f239676dfe8f748c0c2a3fabf8cf40a826", GitTreeState:"clean", BuildDate:"2022-02-24T23:08:31Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/arm64"}
kubectl -n kube-system get pod
NAME READY STATUS RESTARTS AGE
helm-install-traefik--1-2d64v 0/1 Completed 15 90m
svclb-traefik-bkv62 2/2 Running 2 (32m ago) 38m
svclb-traefik-7s99x 2/2 Running 2 (32m ago) 38m
svclb-traefik-6lh88 2/2 Running 2 (32m ago) 37m
svclb-traefik-85xdt 2/2 Running 2 (32m ago) 38m
svclb-traefik-fhg6v 2/2 Running 2 (32m ago) 37m
svclb-traefik-mnzk5 2/2 Running 2 (32m ago) 37m
traefik-5dd496474-b922f 1/1 Running 1 (32m ago) 39m
coredns-96cc4f57d-r8k4h 1/1 Running 1 (32m ago) 91m
svclb-traefik-jg974 2/2 Running 2 (32m ago) 37m
svclb-traefik-p69xv 2/2 Running 2 (32m ago) 38m
svclb-traefik-4sv95 2/2 Running 2 (34m ago) 38m
svclb-traefik-pj9zm 2/2 Running 2 (32m ago) 38m
svclb-traefik-xzrgw 2/2 Running 2 (32m ago) 37m
local-path-provisioner-84bb864455-sd4sc 1/1 Running 17 (32m ago) 91m
svclb-traefik-rkrtd 2/2 Running 2 (32m ago) 37m
metrics-server-ff9dbcb6c-kxg4z 1/1 Running 17 (32m ago) 91m
svclb-traefik-qh96n 2/2 Running 0 39m
I have reinstalled the latest server and agent versions, but the installation process wouldn't install a new kube-proxy.
CodePudding user response:
Kubernetes allows to reinstall kube-proxy
, so the docs for reinstalling kube-proxy told me to launch this command:
$ kubeadm init phase addon kube-proxy --kubeconfig ~/.kube/config --apiserver-advertise-address 192.168.22.101
[addons] Applied essential addon: kube-proxy
... and tadaah my fault got repaired, kube-proxy was reinstalled in my cluster by creating a DaemonSet and launcing the pods.