<p>In my macos I can use below to launch kubernetes dashboard:</p>
<pre><code># launch k8s dashboard
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended.yaml

# Enable the local access proxy, listening on port 8001 by default
$ kubectl proxy
</code></pre>
<p>I have a question about this, why there have <code>$ kubectl proxy</code> command?
whether launch the dashboard, it do not listen a port by default? why should have a proxy?</p>

user7693832
<p>This command allows the dashboard to call the Kubernetes API Server. It handles locating the API server and authenticating: see <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#using-kubectl-proxy" rel="nofollow noreferrer">https://kubernetes.io/docs/using-kubectl-proxy</a></p>
<p>Without it, the dashboard will not be able to connect to the API Server since its endpoints is unknown (from dashboard perspective).
If you want to use the API Server endpoint directly, you will have to add an authenticatin token to each requests and you will also have to configure CORS on Kubernetes API Server. See option <code>--cors-allowed-origins</code> <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/</a></p>
