/docker-elasticsearch

ElasticSearch with Kubernetes Discovery

Primary LanguageShellMIT LicenseMIT

ElasticSearch on Kubernetes

Build Status Docker Repository on Quay

ElasticSearch 5.5.1 with kubernetes discovery plugin for simple deployment and discovery.

Configuration

Configuration is done via environment variables.

The following configuration defaults may not necessarily be set to the same values in kube/ example files.

Plugins

Kubernetes Discovery

For more kubernetes discovery plugin related options, see https://github.com/fabric8io/kubernetes-client. Our examples use just a standard kubernetes auth token to authenticate against the kubernetes API for discovery.

Search Guard SSL

If you want to use transport TLS, please take a look at their documentation https://github.com/floragunncom/search-guard-ssl.

ElasticSearch expects truststore.jks and keystore.jks files to be placed in /elasticsearch/config/certs. Keystore cert/key alias must be cert and truststore alias - ca. Bare in mind that certs need to be signed by the same CA. If you use vault, then take a look at https://github.com/UKHomeOffice/vaultjks, which could help you to get your certs from vault and create keystore files.

Deployment

By default if you start the docker container, ElasticSearch will start in standalone mode.

Deploying onto a Kubernetes cluster is fairly easy. There are example kubernetes controller and service files in kube/ directory.

Deploy Master Node

First of all we need to deploy master service for ES master nodes to find each other and other communications between nodes. Then we can create the master replication controller.

$ kubectl create -f kube/es-master-svc.yaml
$ kubectl create -f kube/es-master-rc.yaml

Wait a few seconds and verify whether it is up and running. You can also scale the master nodes to 3.

$ kubectl logs -f es-master-fdfw -c elasticsearch
$ kubectl scale --replicas=3 rc/es-master

Deploy Client and Data Nodes

Once the master node is up and running, you can start deploying the rest of the cluster.

$ kubectl create -f kube/es-svc.yaml
$ kubectl create -f kube/es-client-rc.yaml
$ kubectl create -f kube/es-data-rc.yaml