kubernetes - 如何让 kubernetes 仪表板的 kubectl 代理正常工作?
问题描述
我在运行 ubuntu server 20.04 的三台服务器上设置了一个高可用的 microk8s 集群。我启用了仪表板插件并尝试使用命令转发它
kubectl port-forward -n kube-system service/kubernetes-dashboard 10443:443
在 WSL Ubuntu 中,在 kubeconfig 文件中配置了 microk8s 集群,但它返回了错误
error: error upgrading connection: error dialing backend: dial tcp 192.168.250.235:10250: connect: no route to host
所以然后我尝试microk8s dashboard-proxy
在其中一台服务器上运行以查看是否可行,它返回了错误
Checking if Dashboard is running.
Dashboard will be available at https://127.0.0.1:10443
Use the following token to login:
<TOKEN>
error: error upgrading connection: error dialing backend: dial tcp 192.168.250.235:10250: connect: no route to host
Traceback (most recent call last):
File "/snap/microk8s/1710/scripts/wrappers/dashboard-proxy.py", line 80, in <module>
dashboard_proxy()
File "/snap/microk8s/1710/scripts/wrappers/dashboard-proxy.py", line 74, in dashboard_proxy
check_output(command)
File "/snap/microk8s/1710/usr/lib/python3.5/subprocess.py", line 626, in check_output
**kwargs).stdout
File "/snap/microk8s/1710/usr/lib/python3.5/subprocess.py", line 708, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/snap/microk8s/current/microk8s-kubectl.wrapper', 'port-forward', '-n', 'kube-system', 'service/kubernetes-dashboard', '10443:443', '--address', '0.0.0.0']' returned non-zero exit status 1
在 microk8s 集群中启用了插件仪表板、dns、ha-cluster、helm3 和 metrics-server。
kubectl get nodes
返回以下输出:
NAME STATUS ROLES AGE VERSION
esx02 Ready <none> 93m v1.19.2-34+1b3fa60b402c1c
esx03 Ready <none> 87m v1.19.2-34+1b3fa60b402c1c
esx01 Ready <none> 101m v1.19.2-34+1b3fa60b402c1c
esx01 的 IP 为 192.168.250.51,esx02 的 IP 为 192.168.250.52,esx03 的 IP 为 192.168.250.53。
的输出kubectl -n kube-system describe service/kubernetes-dashboard
是:
Name: kubernetes-dashboard
Namespace: kube-system
Labels: k8s-app=kubernetes-dashboard
Annotations: <none>
Selector: k8s-app=kubernetes-dashboard
Type: ClusterIP
IP: 10.152.183.174
Port: <unset> 443/TCP
TargetPort: 8443/TCP
Endpoints: 10.1.40.194:8443
Session Affinity: None
Events: <none>
解决方案
推荐阅读
- angular - 角度服务未将数据分配给局部变量
- sql - 在 PHP 中显示错误消息,而不是在重复条目上显示服务器错误消息
- javascript - React:如何在 Popup 关闭时发送数据?
- python - 范围内数据框所有列的最小值
- python-3.x - 将回归线方程和 R 方添加到 PLOTNINE
- java - 为什么冒泡排序外循环在 n-1 处结束?
- c# - 在 C# 中反转字符串中的元音
- python - 配置新的 NLTK 路径
- image - 如何减小 UWP 应用程序的大小(我可以压缩高清图像吗?)
- python - 当相关列中的值不为空时,如何编写一个函数来查找列中的值为空的所有行