nginx Reverseproxy for Kibana gives empty dashboard on kubernetes

7/12/2021

We have Deployed Kibana & Elastic Search on our Kubernetes Cluster. I want to access Kibana via my Nginx by configuring reverse proxy . I am able to configure the nginx.conf with kibana url but when I go to nginx_url/Kibana it gives me a White Dashboard ,no content on the web . It is Strange because i got it worked on my Local machine & it worked but same configuration on kubernetes giving me Empty response .

Below is my Kibana deployment file

<!-- begin snippet:-->
apiVersion: apps/v1
kind: Deployment
metadata:
  #namespace: vpd-cluster-elk
  name: kibana
  labels:
    app: kibana
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kibana
  template:
    metadata:
      labels:
        app: kibana
    spec:
      containers:
      - name: kibana
        image: docker.elastic.co/kibana/kibana:7.10.1
        resources:
          limits:
            cpu: 1000m
          requests:
            cpu: 100m
        env:
          - name: ELASTICSEARCH_URL
            value: "http://ES_Url:9200"
          - name: SERVER_BASEPATH
            value: "/app/home"
          - name: SERVER_REWRITEBASEPATH
            value: "false"
        
        ports:
        - containerPort: 5601
      volumes:
      - name: "config"
        configMap:
          name: kibana-config
---
apiVersion: v1
kind: Service
metadata:
  #namespace: vpd-cluster-elk
  name: kibana
  labels:
    app: kibana
spec:
  ports:
  - port: 5601
    targetPort: 5601
  selector:
    app: kibana
  type: LoadBalancer
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: kibana-config
data:
  kibana.yml: |
    ---
    server.name: kibana
    elasticsearch.url: http://ES_url:9200
    # server.basePath: /app/home
    # server.rewriteBasePath: true
<!-- end snippet -->

Below is my Nginx.conf file

<!-- begin snippet-->
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-conf
data:
  nginx.conf: |
    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
         # To allow special characters in headers
         
         
         ignore_invalid_headers off;

         client_max_body_size 0;

         proxy_buffering off;
         
         server {
         
            listen       80;
            server_name  _;
            
           location /app/home{
            proxy_http_version 1.1;
                       
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
            proxy_pass http://Kibana_Url:5601;
           
    }
           }
        
                            
            
           
    }
 
<!-- end snippet -->

Kindly let me know what I am wrong or do i need any additional configurations

-- Nishar sheik
elk
kibana
kubernetes
nginx
nginx-reverse-proxy

0 Answers