使用配置文件的Kubernetes仪表板访问权限数据不足,无法创建身份验证信息结构. [英] Kubernetes Dashboard access using config file Not enough data to create auth info structure.

查看:1374
本文介绍了使用配置文件的Kubernetes仪表板访问权限数据不足,无法创建身份验证信息结构.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用配置文件访问kubernetes仪表板.从身份验证中,当我选择配置文件时,会给出"Not enough data to create auth info structure".同样的配置文件也可用于kubectl命令.

I am trying to access the kubernetes Dashboard using the config file. From the authentication when I select config file its giving ‘Not enough data to create auth info structure.’ Bu the same config file work for kubectl command.

这是我的配置文件.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://kubemaster:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

有任何解决此问题的帮助吗?

Any help to resolve this issue?

谢谢 SR

推荐答案

查看此答案后

After looking at this answer How to sign in kubernetes dashboard? and source code figured the kubeconfig authentication.

在主服务器上安装kubeadm之后,获取默认服务帐户令牌并将其添加到配置文件中.然后使用配置文件进行身份验证.

After kubeadm install on the master server get the default service account token and add it to config file. Then use the config file to authenticate.

您可以使用它来添加令牌.

You can use this to add the token.

#!/bin/bash
TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}')

kubectl config set-credentials kubernetes-admin --token="${TOKEN}"

您的配置文件应如下所示.

your config file should be looking like this.

kubectl config view |cut -c1-50|tail -10
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
    token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.ey

这篇关于使用配置文件的Kubernetes仪表板访问权限数据不足,无法创建身份验证信息结构.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆