删除了 kube-proxy

Deleted kube-proxy

我不小心从我的 k3s 集群中删除了 kube-proxy。我怎样才能恢复它? 任何对象类型不再存在,此命令给出空结果:

kubectl get all --all-namespaces | grep prox

首先,我使用 k3sup install --ip $SERVER_IP --user $K3SUPUSER

通过 arkade / k3sup 安装了该集群

kubectl 集群信息

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 获取节点

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 版本

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 获取 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

我已经重新安装了最新的服务器和代理版本,但是安装过程不会安装新的 kube-proxy。

Kubernetes 允许重新安装 kube-proxy,因此 docs for reinstalling kube-proxy 告诉我启动此命令:

$ kubeadm init phase addon kube-proxy  --kubeconfig ~/.kube/config  --apiserver-advertise-address 192.168.22.101
[addons] Applied essential addon: kube-proxy

...我的错误得到了修复,通过创建 DaemonSet 并启动 pods.

在我的集群中重新安装了 kube-proxy