<p>I recently installed Kubernetes using Kubernetes Operations tool, but when I installed Kubernetes Dashboard using <a href="https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml" rel="nofollow noreferrer">this</a> script, the dashboard endpoints were in a private cluster.</p>

<p>Is there a way I can expose this dashboard over a public network using something like a service type <code>LoadBalancer</code> and put it behind a password or a secure authentication?</p>

<p>There is a lot that can be done with such a Dashboard, which is why I would like it behind a secure endpoint.</p>

<p>You can easily accomplish that with <a href="http://kubernetes.io/docs/user-guide/ingress/" rel="nofollow noreferrer">Ingress</a> coupled with <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx" rel="nofollow noreferrer">NginX IngressController</a> </p>

<p>if you use something like :</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dashboard.mydomain.tld
  namespace: kube-system
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-realm: "Auth required"
    ingress.kubernetes.io/auth-secret: htpasswd
spec:
  rules:
  - host: dashboard.mydomain.tld
    http:
      paths:
      - path: /
        backend:
          serviceName: &lt;dashsvc&gt;
          servicePort: &lt;dashport&gt;
</code></pre>

<p>alongside with a proper <code>htpasswd</code> secret as indicated by auth-secret annotation</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: htpasswd
  namespace: kube-system
type: Opaque
data:
  auth: &lt;your htpasswd base64&gt;
</code></pre>

<p>note: You need a working ingress controller setup prior to using this for exposing your service to the world. You can also easily combine it with <code>kube-lego</code> for automated <code>https</code> support so your service is exposed over secured channel.</p>
