Kubernetes Kubeadm 单节点,仪表板 "malformed http response"

Kubernetes Kubeadm single node, dashboard "malformed http response"

我刚刚完全按照 kubeadm 指南设置了一个单节点 Kubernetes 集群。集群本身看起来不错,所有 pods 都是 运行 正确:

will@kubemaster:~$ sudo kubectl get pods --all-namespaces
NAMESPACE     NAME                                        READY     STATUS    RESTARTS   AGE
kube-system   calico-etcd-w6dkj                           1/1       Running   0          16m
kube-system   calico-node-mjsnr                           2/2       Running   0          16m
kube-system   calico-policy-controller-59fc4f7888-vc6x6   1/1       Running   0          16m
kube-system   etcd-kubemaster                             1/1       Running   0          16m
kube-system   kube-apiserver-kubemaster                   1/1       Running   1          16m
kube-system   kube-controller-manager-kubemaster          1/1       Running   0          16m
kube-system   kube-dns-545bc4bfd4-mbbrl                   3/3       Running   0          16m
kube-system   kube-proxy-wkmlj                            1/1       Running   0          16m
kube-system   kube-scheduler-kubemaster                   1/1       Running   0          16m
kube-system   kubernetes-dashboard-7f9dbb8685-rxwfw       1/1       Running   0          4m

我使用以下方法安装了仪表板:

sudo kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

我已经尝试通过 运行 "sudo kubectl proxy" 在本地提供 kubrnetes 仪表板。

当我加载“http://127.0.0.1:8001" I get the API endpoint listing, and all looks well. But when I add the /ui to load the dashboard (http://127.0.0.1:8001/ui) 时,我得到以下响应:

Error: 'malformed HTTP response "\x15\x03\x01\x00\x02\x02"'
Trying to reach: 'http://192.167.141.3:8443/'

另请注意,上面的 URL 被重定向到 API:

http://localhost:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy/

如果我用 HTTPS 替换 HTTP,我会得到 "Secure connection failed, SSL recieved a record that exceeded the maximum permisslbe length"。

如果我尝试在不使用 kubectl 代理的情况下加载仪表板,例如使用主 IP,连接被拒绝。

我是运行 Ubuntu 16.04,我的kubectl版本详情如下:

will@kubemaster:~$ sudo kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

从 v1.7 开始,Dashboard 默认只能通过 HTTPS 访问。

可在 http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/kubectl proxy 购买。

使用 HTTP 部署仪表板(不推荐用于生产环境)

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/alternative/kubernetes-dashboard.yaml

可以使用 kubectl proxyhttp://localhost:8001/ui 加载仪表板。