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

如何访问Docker Desktop内置Kubernetes集群中运行的Service?

Accessing Your Kubernetes Pod via Browser in Docker Desktop

Great question! Since you're using Docker Desktop's built-in Kubernetes cluster, accessing your LoadBalancer service is straightforward, though it works a bit differently than cloud-based Kubernetes environments. Here's how to get your pod's HTTP resources loaded in your browser:

Docker Desktop automatically handles LoadBalancer services by proxying them to your local localhost address using the service's port value (8037 in your spec). Simply open your browser and navigate to:

http://localhost:8037

This routes traffic directly from your local machine to the service, which forwards it to your pod's targetPort (80, where your HTTP service is running).

Method 2: Use the NodePort

Your service is also configured with a NodePort (31534), which you can use as an alternative way to access the pod. Since Docker Desktop runs Kubernetes nodes locally, you can use localhost plus the NodePort:

http://localhost:31534

NodePorts expose services on every node's IP at the specified port, and in Docker Desktop, the node's IP maps directly to your local machine's localhost.

Quick Troubleshooting Checks

If you're still having issues connecting, verify that the service is properly linked to your pod:

  • View detailed service info to confirm port configurations and cluster IP:
    kubectl describe service <your-service-name>
    
  • Check that the service has active endpoints pointing to your pod:
    kubectl get endpoints <your-service-name>
    
    You should see your pod's IP listed here—this confirms the service is correctly routing traffic to the pod.

内容的提问来源于stack exchange,提问作者Cory Klein

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 11:07:16