Kubernetes Dashboard access using config file Not enough data to create auth info structure.

前端 未结 8 1557
暖寄归人
暖寄归人 2020-12-08 04:14

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

8条回答
  •  时光取名叫无心
    2020-12-08 04:35

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

    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
    

提交回复
热议问题