Custom Kibana Image readiness woes

Hey all, for an internal deploy of ECK, we are using a custom docker image that we host on GCR (gcr.io/etc/etc/kibana:latest). in the Dockerfile, I replace some images that are part of the assets, then remove the optimize folder so that they can be built on boot. Unfortunately, it seems as though kibana's readinessProbe only has an initialDelay of 10 seconds. And unfortunately, the optimizing process takes fairly longer than this, causing this pod to go into a boot loop.

Two questions:

  1. Is there some way for me to force the optimize in the Dockerfile during build time?
  2. If not, any way to modify the readinessProbe for the Kibana CRD? I am on 0.8

Cheers,

Alright, I've managed to solve this myself. Its definitely a hack but it does work.

Here is my dockerfile:

FROM docker.elastic.co/kibana/kibana:7.2.0

ARG loadingIcon=url\('data:image/png;base64,insertbase64pnghere);

# Use sed to drop our loading icon into the correct places. 
RUN sed -i 's@url("data:image.*;@'"${loadingIcon}"'@g' /usr/share/kibana/src/legacy/ui/ui_render/views/chrome.pug
RUN sed -i 's@url("data:image.*;@'"${loadingIcon}"'@g' /usr/share/kibana/src/legacy/ui/ui_render/views/ui_app.pug

# Clear the optimize folder 
RUN rm -rf /usr/share/kibana/optimize/*
# copy over the optimize script
COPY optimize.sh /usr/share/kibana/
RUN sh /usr/share/kibana/optimize.sh

and this is optimize.sh, which essentially just runs kibana for 5 minutes, then kills it, which gives it time to build out the optimize folder.

#!/bin/bash
/usr/share/kibana/bin/kibana &
prog_pid=$!
sleep 300
kill -9 $prog_pid

Essentially, whenever I build this docker image, it runs kibana momentarily to rebuild the optimize folder. When kubernetes then deploys it, the readinessProbes pass.

1 Like

Just a note that starting with 0.9 you have the ability to define the full pod template for the Kibana pods including a custom readiness probe.

1 Like