Is it possible to run dashboard UI locally via docker run, but using api proxied from remote server?


Our company dropped support for Kubernetes UI leaving us just CLI options.

I would love to ask therefore, is it possible somehow to run dashboard UI ( since is like a web app ) in a separate container on localhost, sharing with it api server via kubectl proxy?

Thank you!

[Courtesy of Google DeepMind]

Yes, it is indeed possible to run the Kubernetes Dashboard UI in a Docker container on your local machine while proxying the API server from a remote Kubernetes cluster. Here’s a high-level approach to achieving this:

Step 1: Set Up kubectl Proxy

First, ensure that kubectl is configured correctly to communicate with your remote Kubernetes cluster. Once that’s established, you can start a proxy to the Kubernetes API server using the following command:

shCopy code

kubectl proxy --port=8080

This command makes the Kubernetes API server accessible locally at http://localhost:8080. The proxy server forwards requests to the remote Kubernetes API server, effectively acting as a middleman.

Step 2: Run Kubernetes Dashboard in Docker

To run the Kubernetes Dashboard in a Docker container and connect it to the proxied API server, you can follow these steps:

  1. Pull the Kubernetes Dashboard Docker Image: You’ll need to pull the official Kubernetes Dashboard image from Docker Hub or any other container registry hosting the image.

shCopy code

docker pull kubernetesui/dashboard:v2.0.0  # Use the latest version
  1. Run the Dashboard Container: Start a Docker container from the Dashboard image. You’ll need to configure the container to use the host network to easily access the kubectl proxy. This is done using the --network="host" option in the docker run command.

shCopy code

docker run --rm -it --network="host" kubernetesui/dashboard:v2.0.0

Using the host network mode allows the Dashboard running inside the container to access services running on the host machine, including the kubectl proxy.

Step 3: Access the Dashboard

With the kubectl proxy running and the Dashboard UI running in a Docker container, you can access the Dashboard through your web browser at the following URL:

bashCopy code


Step 4: Authentication

To access the Dashboard, you will need an authentication token. You can use a Service Account token or a kubeconfig file for authentication. If you don’t have a Service Account with the necessary permissions, you might need to create one and assign the appropriate roles.

  1. Create a Service Account (if necessary):

shCopy code

kubectl create serviceaccount dashboard-admin -n kube-system
  1. Bind the Service Account to a Cluster Role:

shCopy code

kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
  1. Get the Token:

shCopy code

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

Copy the token and use it to log in to the Dashboard UI.


  • Ensure that your local firewall or security settings allow traffic between your local machine and the remote Kubernetes cluster.
  • Be mindful of security implications, especially when exposing the Kubernetes API server, even if it’s just locally. Ensure proper authentication and authorization mechanisms are in place.
  • Versions and configurations might vary, so adjust commands accordingly.

This setup should help you get the Kubernetes Dashboard running locally while interacting with a remote Kubernetes cluster.

Unfortunately this seems to be AI generated response and I do jot think this approach will work just as is… I think we need to have more parameters for container at least