How do I set up a Kubernetes Dashboard on an Amazon EKS cluster?

Last updated: 2021-02-03

I want to set up a Kubernetes Dashboard on an Amazon Elastic Kubernetes Service (Amazon EKS) cluster.

Resolution

Set up your environment

Note: If necessary, connect to your Amazon Elastic Compute Cloud (Amazon EC2) instance using SSH. The syntax in the code examples below applies to Linux servers.

1.    Install kubectl and aws-iam-authenticator.

2.    To configure your kubeconfig file to point to the Amazon EKS control plane, run the following command:

$ aws eks update-kubeconfig --name EKS_ClusterName

Note: Replace EKS_ClusterName with your EKS cluster name. For additional information on configuring your kubeconfig file, see update-kubeconfig.

3.    To verify that worker nodes are running in your environment, run the following command:

$ kubectl get nodes

4.    To verify that the Kubernetes service is running in your environment, run the following command:

$ kubectl get svc

Create a Kubernetes Dashboard

1.    Complete the steps for Step 2: Deploy the Kubernetes dashboard in Tutorial: Deploy the Kubernetes Dashboard (web UI).

2.    Complete the steps for Step 3: Create an eks-admin service account and cluster role binding in Tutorial: Deploy the Kubernetes Dashboard (web UI).

3.    To forward all requests from your Amazon EC2 instance localhost port to the Kubernetes Dashboard port, run the following command:

$ kubectl port-forward svc/kubernetes-dashboard -n kubernetes-dashboard 6443:443

4.    To access the port from your local machine with an SSH tunnel, run the following command:

ssh -i EC2KeyPair.pem ec2-user@IP -L 6443:127.0.0.1:6443

Access the Kubernetes Dashboard in a browser

1.    To access your Kubernetes Dashboard in a browser, enter https://127.0.0.1:6443.

Note: The Kubernetes Dashboard loads in the browser and prompts you for input.

2.    To get a bearer token for authentication (from the Kubernetes website), return to the command line, and run the following command:

$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')

3.    Copy the token from the command line output.

4.    In your browser, in the Kubernetes Dashboard pop-up window, choose Token.

5.    Paste the token from the output into the Enter token box, and then choose SIGN-IN.

You now have access to the Kubernetes Dashboard in your browser.


Did this article help?


Do you need billing or technical support?