使用头盔安装kubernetes-dashboard失败

时间:2019-10-24 22:40:23

标签: kubernetes kubernetes-helm kubernetes-dashboard

我刚刚创建了一个新的kubernetes集群。除了设置集群外,我唯一要做的就是使用helm init安装Tiller并通过helm install stable/kubernetes-dashboard安装kubernetes仪表板。

helm install命令似乎成功,并且helm ls输出:

NAME                    REVISION        UPDATED                         STATUS          CHART                           APP VERSION     NAMESPACE
exhaling-ladybug        1               Thu Oct 24 16:56:49 2019        DEPLOYED        kubernetes-dashboard-1.10.0     1.10.1          default  

但是,等待几分钟后,部署仍未准备就绪。

运行kubectl get pods会显示窗格的状态为CrashLoopBackOff

NAME                                    READY   STATUS             RESTARTS   AGE
exhaling-ladybug-kubernetes-dashboard   0/1     CrashLoopBackOff   10         31m

广告连播的说明显示了以下事件:

Events:
  Type     Reason     Age                   From                 Message
  ----     ------     ----                  ----                 -------
  Normal   Scheduled  31m                   default-scheduler    Successfully assigned default/exhaling-ladybug-kubernetes-dashboard to nodes-1
  Normal   Pulling    31m                   kubelet, nodes-1     Pulling image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1"
  Normal   Pulled     31m                   kubelet, nodes-1     Successfully pulled image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1"
  Normal   Started    30m (x4 over 31m)     kubelet, nodes-1     Started container kubernetes-dashboard
  Normal   Pulled     30m (x4 over 31m)     kubelet, nodes-1     Container image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1" already present on machine
  Normal   Created    30m (x5 over 31m)     kubelet, nodes-1     Created container kubernetes-dashboard
  Warning  BackOff    107s (x141 over 31m)  kubelet, nodes-1     Back-off restarting failed container

日志显示以下紧急消息

panic: secrets is forbidden: User "system:serviceaccount:default:exhaling-ladybug-kubernetes-dashboard" cannot create resource "secrets" in API group "" in the namespace "kube-system"

我做错什么了吗?为什么它试图在一个无法实现的地方创建秘密?

是否可以在不授予仪表板帐户群集管理权限的情况下进行设置?

4 个答案:

答案 0 :(得分:2)

检查这个队友:

https://akomljen.com/installing-kubernetes-dashboard-per-namespace/

您可以根据需要创建自己的角色。

答案 1 :(得分:1)

基于您所发布的错误,快乐的是:
1.舵机正在尝试安装仪表板,但默认情况下它正在拾取您提供的名称空间。

为解决该问题:
1.根据您要安装的命名空间创建角色,默认情况下命名空间应为:default
2.只需将头盔图安装在头盔图所需的正确位置即可,您可以这样做:

helm install stable/kubernetes-dashboard --name=kubernetes-dashboard --namespace=kube-system

答案 2 :(得分:0)

尝试创建clusterrole

kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

答案 3 :(得分:0)

默认情况下,我将名称空间设置为默认值,但是如果是其他名称空间,则需要替换为

function saveFile(contents, name) {
  const blob = new Blob([contents], {type: 'text/plain'});
  const url = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.download = name;
  link.href = url;
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
}