如何使Kubernetes仪表板的Kubectl代理正常工作?

时间:2020-10-17 19:04:42

标签: kubernetes microk8s

我正在运行ubuntu服务器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>

0 个答案:

没有答案