How to create admin user in Kubernetes to login to Dashboard
Providing developers and businesses a reliable, easy-to-use cloud computing platform of virtual servers (Droplets)…m.do.co
Before we start to make things even easier let’s create a simple alias. I called my alias “kube” and it will be referring the –kubeconfig at all times. I’ll be using it throughout this article so adjust your environment to your liking so you can follow along. Here’s my alias:
[kstaykov@manja ~]$ alias kube alias kube='kubectl --kubeconfig=/home/kstaykov/Downloads/k8s-1-11-1-do-1-lon1-1540329911350-kubeconfig.yaml' [kstaykov@manja ~]$
Now it’s time to setup your service account. Use this command:
kube create -n kube-system serviceaccount admin
Notice that I created my service account in the kube-system namespace. If you want to know what namespaces you have you can get them using:
kube get namespaces
Now let’s put on a very permissive role binding setting for our cluster.
Note that this policy will allow for ALL service accounts to act as administrators. Bare it in mind and don’t use this for production service. The concept of this article is to make a simple testing cluster.
Now it’s time to get the configuration of our user.
“message”: “services \”https:kubernetes-dashboard:\” is forbidden: User \”system:anonymous\” cannot get resource \”services/proxy\” in API group \”\” in the namespace \”kube-system\””, “reason”: “Forbidden”…