pires / kubernetes-elasticsearch-cluster

Elasticsearch cluster on top of Kubernetes made easy.
Apache License 2.0
1.51k stars 687 forks source link

[Feature/Support request] Nginx Ingress for Kibana #176

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello! Maybe it is a good idea to add nginx ingress to kibana? Something like this:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx-ingress-kibana-basic-auth
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/auth-type: basic
    nginx.ingress.kubernetes.io/auth-secret: http-auth
    nginx.ingress.kubernetes.io/auth-realm: "Password or GTFO"
spec:
  rules:
  - http:
      paths:
      - path: /kibana
        backend:
          serviceName: kibana
          servicePort: 80

But I am having a hard time trying to add this while simultaneously retain ability to access Kibana through API Server proxy. What basepath should I specify?

pires commented 6 years ago

That would require depending on nginx ingress controller so I don't think it would be wise to enforce that.

ghost commented 6 years ago

Of course! I thought to offer it as an option.

pires commented 6 years ago

Sure, open the PR.

pires commented 6 years ago

Closing due to inactivity. Will re-open if a PR is open to address this.

GitShaffi commented 6 years ago

@Unb9rn Were you able to proxy kibana behind ingress?? Any work arounds?

ghost commented 6 years ago

@GitShaffi I had no problems running Kibana with nginx ingress (just a simple ingress spec will do) the problem waswith running kibana both on apiserver proxy and ingress.

GitShaffi commented 6 years ago

@Unb9rn However I am not able to get this to work.

spec:
  rules:
  - http:
      paths:
      - path: /kibana
        backend:
          serviceName: kibana
          servicePort: 80

But I am able to get it working, if I proxy it at root '/' .

ghost commented 6 years ago

@GitShaffi I am using it with basic auth with htpasswd stored in secret, but you may be able to adapt it for you. Also, I am serving it as a subdomain in /

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx-ingress-kibana-basic-auth
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-secret: http-auth
    ingress.kubernetes.io/auth-realm: "Password, tits or GTFO"
spec:
  tls:
  - hosts:
    - kibana.example.com
    secretName: tlssecret
  rules:
  - host: kibana.example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: kibana
          servicePort: 80