//Cloud notes from my desk -Maheshk

"Fortunate are those who take the first steps.” ― Paulo Coelho

[k8s] Kubernetes dashboard access warnings

Accessing your Kubernetes dashboard through proxy you might experience this warning.

Sample text: configmaps is forbidden: User “system:serviceaccount:kube-system:kubernetes-dashboard” cannot list configmaps in the namespace “default” k8rbac

Resolution: From the message it is apparent that, access to the dashboard is restricted. Solution is to add the required rolebinding as below.

Two ways to do it. You can create the binding with simple one liner from CLI or YAML way.

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

or  YAML way to create the role binding. Create the below Yaml file with some name say “dashboard-rolebinding.yaml” and submit for creation in the same Kubectl.

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system

$ kubectl create -f dashboard-rolebinding.yaml

PS- I had this experience when I access my AKS cluster, so not sure about other providers or distribution at this time of writing.

update:

$kubectl proxy

http://localhost:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy/#!/node?namespace=default

 

Advertisements

2019-01-26 Posted by | Kubernetes, Uncategorized | | Leave a comment

   

%d bloggers like this: