You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从外部访问Play with Kubernetes中的Kubernetes Dashboard?

Troubleshooting Kubernetes Dashboard Access on Play with Kubernetes

Hey there, let's break down why you're having trouble accessing the Kubernetes Dashboard in your Play with Kubernetes environment—this is a common gotcha with the default Dashboard setup!

The Core Issue

By default, the Kubernetes Dashboard Service is created as a ClusterIP type (as you saw in your output: TYPE ClusterIP). ClusterIPs are only accessible inside the Kubernetes cluster, so they can't be reached directly from the Play with Kubernetes UI or your local browser. Play with Kubernetes relies on exposing services via NodePorts to make them externally accessible.

Step-by-Step Fix

Here’s exactly what you need to do to get the Dashboard working:

  1. Change the Dashboard Service type to NodePort
    Run this command to patch the existing Service and switch it to NodePort mode:

    kubectl patch service kubernetes-dashboard -n kube-system -p '{"spec":{"type":"NodePort"}}'
    
  2. Get the assigned NodePort
    Fetch the updated Service details to find the public port that was automatically assigned:

    kubectl get service kubernetes-dashboard -n kube-system
    

    You’ll see output like this (note the PORT(S) column—this example uses 30007 as the NodePort):

    NAME                   TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
    kubernetes-dashboard   NodePort   10.98.185.58    <none>        443:30007/TCP   1h
    
  3. Access the Dashboard via Play with Kubernetes UI

    • Look at the top-right corner of your master node (or the node where the Dashboard Pod is running—you can confirm with kubectl get pods -n kube-system -o wide | grep kubernetes-dashboard if unsure)
    • Click the Port button, enter the NodePort number you found (e.g., 30007), and hit enter
    • Your browser will open a new tab to the Dashboard. You’ll see a certificate warning (since it uses a self-signed cert)—just proceed past the warning to access the login screen.

Quick Checks to Rule Out Other Issues

  • Make sure the Dashboard Pod is running:
    kubectl get pods -n kube-system | grep kubernetes-dashboard
    
    If it’s not in Running state, wait a minute for it to start, or check logs with kubectl logs <pod-name> -n kube-system for errors.
  • Double-check that you’re using the correct NodePort—don’t try to use the 443 port directly (that’s the internal ClusterIP port).

This should resolve your access issue! The key was switching the Service type from ClusterIP to NodePort, which lets Play with Kubernetes expose the service to the outside world.

内容的提问来源于stack exchange,提问作者Mark Estrada

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:08:39