Cannot access Kibana dashboard

8/22/2018

I am trying to deploy Kibana in my Kubernetes cluster which is on AWS. To access the Kibana dashboard I have created an ingress which is mapped to xyz.com. Here is my Kibana deployment file.

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: kibana
  labels:
    component: kibana
spec:
  replicas: 1
  selector:
    matchLabels:
     component: kibana
  template:
    metadata:
      labels:
        component: kibana
    spec:
      containers:
      - name: kibana
        image: docker.elastic.co/kibana/kibana-oss:6.3.2
        env:
        - name: CLUSTER_NAME
          value: myesdb
        - name: SERVER_BASEPATH
          value: /
        resources:
          limits:
            cpu: 1000m
          requests:
            cpu: 100m
        ports:
        - containerPort: 5601
          name: http
        readinessProbe:
          httpGet:
            path: /api/status
            port: http
          initialDelaySeconds: 20
          timeoutSeconds: 5
        volumeMounts:
          - name: config
            mountPath: /usr/share/kibana/config
            readOnly: true
      volumes:
        - name: config
          configMap:
            name: kibana-config

Whenever I deploy it, it gives me the following error. What should my SERVER_BASEPATH be in order for it to work? I know it defaults to /app/kibana.

FATAL { ValidationError: child "server" fails because [child "basePath" fails because ["basePath" with value "/" fails to match the start with a slash, don't end with one pattern]]
    at Object.exports.process (/usr/share/kibana/node_modules/joi/lib/errors.js:181:19)
    at internals.Object._validateWithOptions (/usr/share/kibana/node_modules/joi/lib/any.js:651:31)
    at module.exports.internals.Any.root.validate (/usr/share/kibana/node_modules/joi/lib/index.js:121:23)
    at Config._commit (/usr/share/kibana/src/server/config/config.js:119:35)
    at Config.set (/usr/share/kibana/src/server/config/config.js:89:10)
    at Config.extendSchema (/usr/share/kibana/src/server/config/config.js:62:10)
    at _lodash2.default.each.child (/usr/share/kibana/src/server/config/config.js:51:14)
    at arrayEach (/usr/share/kibana/node_modules/lodash/index.js:1289:13)
    at Function.<anonymous> (/usr/share/kibana/node_modules/lodash/index.js:3345:13)
    at Config.extendSchema (/usr/share/kibana/src/server/config/config.js:50:31)
    at new Config (/usr/share/kibana/src/server/config/config.js:41:10)
    at Function.withDefaultSchema (/usr/share/kibana/src/server/config/config.js:34:12)
    at KbnServer.exports.default (/usr/share/kibana/src/server/config/setup.js:9:37)
    at KbnServer.mixin (/usr/share/kibana/src/server/kbn_server.js:136:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  isJoi: true,
  name: 'ValidationError',
  details: 
   [ { message: '"basePath" with value "/" fails to match the start with a slash, don\'t end with one pattern',
       path: 'server.basePath',
       type: 'string.regex.name',
       context: [Object] } ],
  _object: 
   { pkg: 
      { version: '6.3.2',
        branch: '6.3',
        buildNum: 17307,
        buildSha: '53d0c6758ac3fb38a3a1df198c1d4c87765e63f7' },
     dev: { basePathProxyTarget: 5603 },
     pid: { exclusive: false },
     cpu: { cgroup: [Object] },
     cpuacct: { cgroup: [Object] },
     server: { name: 'kibana', host: '0', basePath: '/' } },
  annotate: [Function] }

I followed this guide https://github.com/pires/kubernetes-elasticsearch-cluster

Any idea what might be the issue ?

-- Anshul Tripathi
elasticsearch
kibana
kubernetes
kubernetes-ingress

1 Answer

8/22/2018

I believe that the example config in the official kibana repository gives a hint on the cause of this problem, here's the server.basePath setting:

# Enables you to specify a path to mount Kibana at if you are running behind a proxy.
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
# from requests it receives, and to prevent a deprecation warning at startup.
# This setting cannot end in a slash.
#server.basePath: ""

The fact that the server.basePath cannot end in a slash could mean that kibana interprets your setting as ending in a slash basically. I've not dug deeper into this though.

This error message is interesting:

message: '"basePath" with value "/" fails to match the start with a slash, don\'t end with one pattern'

So this error message are a complement to the documentation: don't end in a slash and don't start with a slash. Something like that.

I reproduced this in minikube using your Deployment manifest but i removed the volume mount parts at the end. Changing SERVER_BASEPATH to /<SOMETHING> works fine, so basically i think you just need to set a proper basepath.

-- mikejoh
Source: StackOverflow