kubernetes:部署仪表板时出错(ui)

时间:2017-12-20 10:35:05

标签: kubernetes kops

我已使用kops和以下命令在AWS上成功设置了kubernetes集群:

$ kops create cluster --name=<my_cluster_name> --state=s3://<my-state-bucket> --zones=eu-west-1a --node-count=2 --node-size=t2.micro --master-size=t2.small --dns-zone=<my-cluster-dns>

$ kops update cluster <my-cluster-name> --yes

群集有1个主服务器和2个从服务器。

我正在尝试按照these guidelines使用以下命令部署仪表板:

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

1

我收到以下错误:

secret "kubernetes-dashboard-certs" created
serviceaccount "kubernetes-dashboard" created
error: error validating "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml": error validating data: unknown object type schema.GroupVersionKind{Group:"rbac.authorization.k8s.io", Version:"v1", Kind:"Role"}; if you choose to ignore these errors, turn validation off with --validate=false

2

我的信息中心无法通过https://<my_master_node_public_ip>/ui

访问

相反,我得到以下内容:

kind    "Status"
apiVersion  "v1"
metadata    {}
status  "Failure"
message "endpoints \"kubernetes-dashboard\" not found"
reason  "NotFound"
details 
name    "kubernetes-dashboard"
kind    "endpoints"
code    404

第3 即可。

运行后

kubectl proxy

并尝试通过以下方式访问信息中心:

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

根据相关指南的指示,我有完全相同的问题。

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-11T23:27:35Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.11", GitCommit:"b13f2fd682d56eab7a6a2b5a1cab1a3d2c8bdd55", GitTreeState:"clean", BuildDate:"2017-11-25T17:51:39Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

修改:这是关闭验证错误时的结果:

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml --validate=false
secret "kubernetes-dashboard-certs" configured
serviceaccount "kubernetes-dashboard" configured
service "kubernetes-dashboard" created
Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml": Role in version "v1" cannot be handled as a Role: no kind "Role" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml": RoleBinding in version "v1" cannot be handled as a RoleBinding: no kind "RoleBinding" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml": Deployment in version "v1beta2" cannot be handled as a Deployment: no kind "Deployment" is registered for version "apps/v1beta2"

1 个答案:

答案 0 :(得分:1)

问题是您正在使用kops配置Kubernetes 1.7群集并使用dashboard manifest文件用于Kubernetes 1.8,因此请尝试以下操作(首先核实当前部署),然后:

$ kops create cluster --kubernetes-version="1.8.1" --name=<my_cluster_name> --state=s3://<my-state-bucket> --zones=eu-west-1a --node-count=2 --node-size=t2.micro --master-size=t2.small --dns-zone=<my-cluster-dns>

正如pkaramol指出的那样,除了上面你可以将kops升级到1.8,它也应该可以工作。

请注意,在任何情况下,为了进入仪表板,请执行以下操作:

$ kubectl proxy

...然后可以通过http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

访问信息中心