ElasticSearch 8.12 kibana cluster using vagrant and docker compose

Pre-requisite:
– VirtualBox 7.0.14
– Vagrant 2.4.1
– Windows 10 or better OS
– 16GB RAM (10GB RAM are required for creating ElasticSearch with kibana; 1GB and 2 x ElasticSearch node; 4GB each, rest of the RAM for VM host OS)

Overview:
There are 2 layers of virtualization, first the Virtual Box, then the docker engine running in the Virtual Box VM running on Ubuntu 20.04 focal.

Orchestration used in the host OS level; Windows 10 are the hashicorp vagrant. The vagrant is used to configure the VM Ubuntu OS to be configured to run properly configured docker and Ubuntu 20.04.

Then docker compose v2 are used to create the ElasticSearch 8.12 cluster or stack.

The downside of this example, vagrant up needs to be run initially to configure the VM Ubuntu 20.04 OS. I have yet to discover if Vagrant has the ability to bootstrap grub and configuring the sysctl to allow the docker engine to run properly with the ElasticSearch 8.12 stack.

Here are the bitbucket repository that contains the codes that is mentioned in this post.

Overview of this repo is as follows.

File structure of the ElasticSearch 8.12 running on docker in Ubuntu 20.04 VM

Steps:
1. Run the vagrant up in the project localdev

Vagrant up to start creating the VBox VM that will be running ElasticSearch 8.12 in docker container

2. Wait for the vagrant up to complete

Vagrant up completed, the first time running will force provision shell in Vagrantfile to run and configure the VM host Ubuntu OS to works fine with

3. Confirm the provision script complete by running “vagrant status”

Confirm VM are powered off using “vagrant status”

4. If the VM is powered off, rerun “vagrant up”, then run “vagrant ssh” to login into the VirtualBox VM.

Windows command prompt indicating that the vagrant ssh are successfully logon into VM shell

5. Start up the ElasticSearch 8.12 with 2 ElasticSearch nodes in docker container, cd into /data/docker, then run “sudo docker compose -f docker-compose-duo.yml up -d”

Starting up ElasticSearch 8.12 in the VirtualBox VM
If everything is fine, and the images repo from docker hub will be downloaded for the first time, extracted before running as container in the VM.
the docker compose for ElasticSearch 8.12 completed without issues

6. Confirm the status of the containers, run in the terminal “sudo docker ps”

Proof of containers of ElasticSearch and Kibana are running

This however does not proof that the stacks are completed correctly.

Use the “docker logs” to check all the containers.

Check last 5 line of logs from container ElasticSearch node, es01
Check last 5 line of logs from container ElasticSearch node, es02
Check last 13 line of logs from container Kibana
The official kibana template provides a setup container that are used to create certificate and assigning passwords into nodes.

Other than the checking all the ElasticSearch containers, and kibana, the setup container will be stop running and provide the logs as seen to indicate the configuration of the ElasticSearch is completed.

Finally, to put all into a complete conformation, use browser to visit the kibana and ElasticSearch interface.

Kibana is running on http://127.0.0.1:5601
Successful login, first time into Kibana, now just call it as Elastic
The problem of self-signed certificate, just click continue
Use the default elastic username and password to logon into the ElasticSearch node at https://127.0.0.1:9200
After signing on successfully into https://127.0.0.1:9200
Proof that kibana (now known as Elastic) and ElasticSearch cluster are interconnected.

To truly ensure that the Elastic (kibana) are working well, go into the Dev Tools -> Console. Type “GET _cluster/health”, run the console command, on the right panel of the console, you should receive similar result.

Will add more post on details how to make the example from ElasticSearch 8.13 works. At the time of the post, the example provided by ElasticSearch does not work as expected.

The steps that I was doing to get this ElasticSearch running is akin to Hal trying to fix the light bulb.

Reference:
Install Elasticsearch with Docker | Elasticsearch Guide [8.12] | Elastic

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.