Skip to main content

Shen Zhen, China

Kibana

I already setup Elasticsearch and now want to add the Kibana Dashboard. To get started I first have to exec into the Elasticsearch container - in my case it is called elastic_container-e6d43a0a-300b-ffa7-55f8-7883bee7a412 - and add my Kibana user login:

docker exec -ti elastic_container-e6d43a0a-300b-ffa7-55f8-7883bee7a412 /bin/bash
/usr/share/elasticsearch/bin/elasticsearch-reset-password --interactive --username kibana_system

I will set the password to mykibanapassword and will have to supply this in my kibana.yml configuration file.

Nomad Job

Docker-Compose

I have been using a docker-compose.yml file before to set up a ELK cluster. The Kibana part of looks like:

kibana:
container_name: kibana
restart: unless-stopped
build:
context: kibana/
args:
ELK_VERSION: $ELK_VERSION
volumes:
- type: bind
source: ./kibana/config/kibana.yml
target: /usr/share/kibana/config/kibana.yml
read_only: true
# ports:
# - "5601:5601"
networks:
- wikinet
depends_on:
- elasticsearch

And the kibana.yml that is included in the image during the build process is:

---
## Default Kibana configuration from Kibana base image.
## https://github.com/elastic/kibana/blob/master/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.js
#
server.name: kibana
server.host: 0.0.0.0
server.publicBaseUrl: https://my.kibana.com
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
monitoring.ui.container.elasticsearch.enabled: true

elasticsearch.username: kibana_system
elasticsearch.password: 'mykibanapassword'

Job Specification

The translation into a Nomad job file is:

job "wiki_kibana" {
type = "service"
datacenters = ["wiki_search"]

update {
max_parallel = 1
health_check = "checks"
min_healthy_time = "180s"
healthy_deadline = "5m"
progress_deadline = "10m"
auto_revert = true
auto_promote = true
canary = 1
}

group "wiki_kibana" {
count = 1

network {
port "ki_http" {
static = 5601
}
}

task "kibana_container" {
driver = "docker"
kill_timeout = "600s"
kill_signal = "SIGTERM"

template {
data = <<EOH
server.name: kibana
server.host: 0.0.0.0
server.publicBaseUrl: https://my.kibana.com
elasticsearch.hosts: [ "http://my.server.ip:9200" ]
monitoring.ui.container.elasticsearch.enabled: true
elasticsearch.username: kibana_system
elasticsearch.password: 'mykibanapassword'
EOH

destination = "local/kibana/kibana.yml"
}

config {
network_mode = "host"
image = "docker.elastic.co/kibana/kibana:8.3.2"
command = "kibana"
ports = ["ki_http"]
volumes = [
"local/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml",
]

ulimit {
memlock = "-1"
nofile = "65536"
nproc = "8192"
}
}

service {
name = "kibana"
check {
name = "http-tcp"
port = "ki_http"
type = "tcp"
interval = "30s"
timeout = "4s"
}

# check {
# name = "rest-http"
# type = "http"
# port = "ki_http"
# path = "/"
# interval = "30s"
# timeout = "4s"
# header {
# Authorization = ["Basic myelasticpassword"]
# }
# }
}

resources {
cpu = 1024
memory = 2048
}
}
}
}