A project to run Elastic Cloud on Kubernetes (ECK) in Minikube to enable local prototyping and development.
helm
minikube
- One of the supported
minikube
drivers for your OS
Both of these dependencies can be managed using the tool asdf, and a .tool-versions
is already present in the repository. You will need to install the helm
and minikube
plugins but, once done, you'll be able to run minikube install
to download and install the versions specified in .tool-versions
and configure them automatically on $PATH
:
minikube-eck $ asdf plugin add helm
minikube-eck $ asdf plugin add minikube
minikube-eck $ asdf install
minikube
prefers different drivers depending on your OS, and will attempt to use the preferred drivers automatically depending on what's available on your syste,. If you have (one of) the preferred drivers installed (such as Docker on macOS) then minikube
should Just Work™:
minikube-eck $ minikube start --kubernetes-version=1.19.11
😄 minikube v1.20.0 on Darwin 10.14.6
▪ KUBECONFIG=/Users/scrossan/Developer/repos/minikube-eck/.kubeconfig
✨ Automatically selected the docker driver. Other choices: hyperkit, virtualbox, ssh
👍 Starting control plane node minikube in cluster minikube
🚜 Pulling base image ...
💾 Downloading Kubernetes v1.19.11 preload ...
> preloaded-images-k8s-v10-v1...: 487.92 MiB / 487.92 MiB 100.00% 4.31 MiB
🔥 Creating docker container (CPUs=2, Memory=7914MB) ...
🐳 Preparing Kubernetes v1.19.11 on Docker 20.10.6 ...
▪ Generating certificates and keys ...
▪ Booting up control plane ...
▪ Configuring RBAC rules ...
🔎 Verifying Kubernetes components...
▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟 Enabled addons: storage-provisioner, default-storageclass
🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
Alternatively you can configure minikube
to use a specific driver:
minikube-eck $ minikube start --vm-driver=virtualbox
Configuration for minikube
can be persisted for convenience:
minikube-eck $ minikube config set vm-driver virtualbox
With minikube
up and running, you can proceed to install the ECK operator:
minikube-eck $ helm repo add elastic https://helm.elastic.co
minikube-eck $ helm repo update
minikube-eck $ helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace
Included in this repository are kubernetes manifests that will deploy:
- a 3 node Elasticsearch cluster
- a Kibana instance
- Filebeat to collect logs from all the pods running in the minikube cluster and ship them to Elasticsearch
Deploy them like so, one at a time:
minikube-eck $ kubectl apply -f trial.yaml
minikube-eck $ kubectl apply -f elastic.yaml
minikube-eck $ kubectl apply -f kibana.yaml
minikube-eck $ kubectl apply -f filebeat.yaml
Once everything is deployed, Elasticsearch should be receiving logs from Filebeat and you'll be able to view these in Kibana.
First, set up a port forward to port 5601 on your workstation:
$ kubectl port-forward service/quickstart-kb-http 5601 -n elastic-system
You'll need the superuser password to be able to log in. Since it's autogenerated and stored in a Kubernetes secret, you'll need to get it using kubectl
:
$ kubectl get secret quickstart-es-elastic-user -n elastic-system -o=jsonpath='{.data.elastic}' | base64 --decode; echo
Now navigate to https://localhost:5601 and enter elastic
as the username along with the password you got the previous command.