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.
I have gone to this url and installed nginx.
And i have created this file to access.
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
But still not able to access it.
I did not try it with Ingress, but you probably know that as a quick but not necessarily a good solution, you can also expose it as NodePort?
We managed it like this
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
just added a clusterip service and use a nginx before it as a reverse proxy
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;
}
}
but should also be possible with NodePort