<p>We have a kubernetes environment(3 EC2 instances). I am trying to access the dashboard from outside the cluster, but its showing site can't be reached. So that i gone to some links and found through nginx-ingress we can access it.</p>

<p><a href="https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/deployment/nginx-ingress.yaml" rel="nofollow noreferrer">I have gone to this url</a> and installed nginx.</p>

<p>And i have created this file to access.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.org/ssl-backends: "kubernetes-dashboard"
    kubernetes.io/ingress.allow-http: "false"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
  name: dashboard-ingress
  namespace: kube-system
spec:
  rules:
  - host: serverdnsname
    http:
      paths:
      - path: /dashboard
        backend:
          serviceName: kubernetes-dashboard
          servicePort: 443
</code></pre>

<p>But still not able to access it.</p>

horton
<p>We managed it like this</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
spec:
  ports:
    - port: 80
      targetPort: 9090
  selector:
    k8s-app: kubernetes-dashboard
</code></pre>

<p>just added a clusterip service and use a nginx before it as a reverse proxy</p>

<pre><code>server {
    listen 443 ssl http2;
    server_name kubernetes.dev.xxxxx;

    ssl_certificate /etc/letsencrypt/live/kubernetes.dev.xxxx/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/kubernetes.dev.xxxx/privkey.pem;

    include ssl.conf;

    location / {
        deny all;
        include headers.conf;

        resolver 10.96.0.10 valid=30s; #ip of your dns service inside the cluster
        set $upstream kubernetes-dashboard.kube-system.svc.cluster.local;
        proxy_pass http://$upstream;
    }
}

</code></pre>

<p>but should also be possible with NodePort</p>
