<p>I was just wondering how to manually set the external endpoint used by the Kubernetes web dashboard.</p>

<p>After creating the namespace <em>kube-system</em>, I ran the following:</p>

<pre><code>kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
</code></pre>

<p>Is there a flag I can use to specify which tcp port to use for external access? As far as I can tell it's just randomly assigning one. I've looked through the documentation but I'm having a hard time finding a solution. Any help would be appreciated.</p>

<p>You can specify the desired port as the <code>nodePort</code> in the yaml spec that you use to create the service. In this case, where the yaml file you linked to defines the service as:</p>

<pre><code>- kind: Service
  apiVersion: v1
  metadata:
    labels:
      app: kubernetes-dashboard
      kubernetes.io/cluster-service: "true"
    name: kubernetes-dashboard
    namespace: kube-system
  spec:
    type: NodePort
    ports:
    - port: 80
      targetPort: 9090
    selector:
      app: kubernetes-dashboard
</code></pre>

<p>You would want to define it as below, assuming your desired port number is 33333:</p>

<pre><code>- kind: Service
  apiVersion: v1
  metadata:
    labels:
      app: kubernetes-dashboard
      kubernetes.io/cluster-service: "true"
    name: kubernetes-dashboard
    namespace: kube-system
  spec:
    type: NodePort
    ports:
    - port: 80
      targetPort: 9090
      nodePort: 33333
    selector:
      app: kubernetes-dashboard
</code></pre>
