geoaxis / local-elastic-stack

A local elastic stack using ECK. Installed on k8s that is shipped with docker desktop for windows/mac

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

local-elastic-stack

A simple one stop setup to start a local elastic stack on k8s.

It uses ECK Operator (which is installed using kubectl).

As an optional step this setup uses Ingress-Nginx (which is installed using helm).

To make life easier a self signed certificate is provided. You can install it on your PC as a trusted authority to not get any warnings when using `https`` urls.

All elastic operator stuff is installed in elastic-system namespace, while the stack it slef (elasticsearch, kibana, beats, apm) are installed in a namespace called devoops. Ingress pods are installed in in the ingress-nginx namespace.

image

Steps

  • Install Docker for Desktop. You can probably use this setup on minikube, but it has not been tested.
  • Enable kubernetes on your docker setup. Make sure you have sufficent resources available. The setup has been tested on Mac and Windows.
  • Confirm that your kubernetes setup is working by checking kubectl get pods and/or kubectl get nodes
  • Make sure that kubernetes.docker.internal DNS name resolves to 127.0.0.1 i.e. run nslookup kubernetes.docker.internal and check the result. Look at settings for your docker for desktop. Otherwise edit /etc/hosts file for your machine.
  • Install ECK.
kubectl create -f https://download.elastic.co/downloads/eck/2.10.0/crds.yaml
kubectl apply -f https://download.elastic.co/downloads/eck/2.10.0/operator.yaml

kubectl create namespace ingress-nginx;
kubectl create -n ingress-nginx secret tls nginx-tls-secret --cert=server.crt --key=server.key
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace --set controller.config.compute-full-forwarded-for='"true"' --set controller.config.use-forwarded-headers='"true"' --set controller.extraArgs.default-ssl-certificate=ingress-nginx/nginx-tls-secret;

  • Apply the all-in-one.yml using
kubectl apply -f all-in-one.yaml
  • We used a certificate in the step where we created nginx-tls-secret. To use the certificate just add it to your browser ( on windows it can be done by right clicking the crt file)
  • Browse to http://kubernetes.docker.internal/kibana and use elastic/elastic to login. You can also port forward kibana as following
kubectl port-forward service/kbdev-kb-http 5601 -n devoops

Test

  • Use the following sample repo to test the application

Considerations

  • This setup is meant for testing purposes only (to facilitate local development). It uses checked in default passwords/tokens on purpose. DON'T use those passwords and tokens in production. Alternatively comment out the lines that set the passwords/tokens and ECK will generate them for you witin K8s Secrets.
  • This sample uses Elastic enterprise features using ECK license management features. Please check the EULA for the 30 day trial this software is distributed under.

About

A local elastic stack using ECK. Installed on k8s that is shipped with docker desktop for windows/mac

License:Apache License 2.0