Create Admin User for Kubernetes Dashboard (Web UI) Access

In this blog post, I will show you how to create an Admin user that will allow you to log in to Kubernetes Dashboard in case you are receiving the following error.

Error:

Internal error (500): Not enough data to create auth info structure

With the release of Kubernetes 1.13.4 and RBAC, you can no longer log in to Web UI without creating a Web UI user.

Creating Dashboard Admin User

To create an admin user for Web UI, I will create a .YAML file using the code below and save it.

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system

Using the kubectl command-line utility, I will run the command below.

kubectl apply -f dashboard-adminuser.yaml

Bearer Token

After creating the user account, I will need to get the Bearer token which acts as a login password.

To get the token, I will run the command below:

kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

Note: It is recommended you install Git Bash because | grep will not work with PowerShell and you will need to search for the token from the long list.

In the token list, Search for the token with the name of:

admin-user-token-vX

Next, I will start the Dashboard using the following command and use the token copied from the above step.

kubectl proxy

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.