ELK

Elasticsearch, Logstash, Kibana

Deploy Elasticsearch

Setup the host node

The vm.max_map_count kernel setting needs to be set to at least 262144 for production use. Make sure the node(s) that will host Elasticsearch have the following config:

sysctl -w vm.max_map_count=262144

Create the data dir:

mkdir /storage/storage-001/mnt-elasticsearch
chown nobody:nogroup /storage/storage-001/mnt-elasticsearch/

Create the namespace

Connect to your kubectl workstation and create the namespace:

kubectl create namespace elk

Create the ConfigMap

Create Elasticsearch config file:

cat <<EOF >>elasticsearch.yml

cluster.name: "docker-cluster"
network.host: 0.0.0.0
discovery.zen.minimum_master_nodes: 1
discovery.type: single-node

EOF

Create its ConfigMap:

If you need to update the ConfigMap, run:

Then run:

Deploy Elasticsearch

Run:

Create Elasticsearch service

Run:

Test

Get indices:

Post content:

Another example of post:

Deploy Logstash

Create the ConfigMap (config file)

Create the config file:

Create its ConfigMap:

If you need to update the ConfigMap, run:

Then run:

Create the ConfigMap (pipeline)

Create the config file:

Replace output.elasticsearch.hosts with your Elasticsearch host and port.

Create its ConfigMap:

If you need to update the ConfigMap, run:

Then run:

Deploy

Connect to your node and create the data dir:

Connect to your kubectl workstation and run:

Create service

Run:

Test

Get service info:

Telnet test:

Deploy Kibana

Create the ConfigMap

Create the config file:

Replace elasticsearch.hosts with your Elasticsearch host and port.

Create its ConfigMap:

If you need to update the ConfigMap, run:

Then run:

Deploy

Connect to your node and create the data dir:

Connect to your kubectl workstation and run:

Replace spec.template.spec.containers.env with your Elasticsearch host and port.

Create service

Run:

Test

Curl test:

Deploy filebeat

Example to stream log files from /elk/*.log to elasticsearch.

Text:

Text:

Text:

Text:

Text:

Text:

Last updated