Kubernetes Kubeadm单节点,仪表板“格式错误的http响应”

我刚刚按照kubeadm指南设置了一个单节点Kubernetes集群.群集本身看起来很好,所有pod都正常运行:

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”时,我获得了API端点列表,并且看起来都很好.但是当我添加/ ui来加载仪表板(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/'

另请注意,以上网址会重定向到API:

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

如果我用HTTPS替换HTTP,我得到“安全连接失败,SSL收到超过最大许可长度的记录”.

如果我尝试在不使用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开始,默认情况下只能通过HTTPS访问仪表板.

它在http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/有kubectl代理.

使用HTTP部署仪表板(不建议用于生产)

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

可以使用kubectl代理在http://localhost:8001/ui加载仪表板.

转载注明原文:Kubernetes Kubeadm单节点,仪表板“格式错误的http响应” - 代码日志