Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Adding Example for Kubernetes KIND #274

Merged
merged 3 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ cd examples/docker-for-mac
make
```

#### KIND - Kubernetes

It is also possible to run this chart using a Kubernetes [KIND (Kubernetes in Docker)](https://github.com/kubernetes-sigs/kind) cluster:

```
cd examples/kubernetes-kind
make
```

## Clustering and Node Discovery

This chart facilitates Elasticsearch node discovery and services by creating two `Service` definitions in Kubernetes, one with the name `$clusterName-$nodeGroup` and another named `$clusterName-$nodeGroup-headless`.
Expand Down
12 changes: 12 additions & 0 deletions elasticsearch/examples/kubernetes-kind/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default: test

RELEASE := helm-es-kind

install:
helm upgrade --wait --timeout=900 --install --values values.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
37 changes: 37 additions & 0 deletions elasticsearch/examples/kubernetes-kind/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# Permit co-located instances for solitary minikube virtual machines.
antiAffinity: "soft"

# Shrink default JVM heap.
esJavaOpts: "-Xmx128m -Xms128m"

# Allocate smaller chunks of memory per pod.
resources:
requests:
cpu: "100m"
memory: "512M"
limits:
cpu: "1000m"
memory: "512M"

# Request smaller persistent volumes.
volumeClaimTemplate:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "standard"
resources:
requests:
storage: 100M
extraInitContainers: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why these extra init containers are needed for a kind deployment? The chart is already correctly setting the permissions and the elasticsearch process should be creating those directories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Crazybus yeah.. that is needed for KIND.. for some reason the container doesn't create that by default and the whole deployment was failing. You can give it a try and see if you find the reason why the container is failing to do so.. I couldn't see anything in the logs except for an exception saying that it didn't had access to write the files in the /usr/share/elasticsearch/data/nodes/ directory. Once the directory is created, everything works as expected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll certainly give it a go to see if I can reproduce it. Seems like a bit of a shame that kind doesn't seem to be compatible with the way that normal kubernetes works though :(. It makes sense that resources and node anti affinity need to be relaxed but this makes it impossible to properly test with kind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be super straight forward to reproduce it and find the cause if you can debug the ElasticSearch container. But for now that is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Crazybus also I notice that for KIND this is required: storageClassName: "standard"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that I haven't gotten around to testing this out just yet. Did you also try just leaving storageClassName out completely? That should just use whatever the default is set to which is probably "standard"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is true.. I am removing that line completely

- name: create
image: busybox:1.28
command: ['mkdir', '/usr/share/elasticsearch/data/nodes/']
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-master
- name: file-permissions
image: busybox:1.28
command: ['chown', '-R', '1000:1000', '/usr/share/elasticsearch/']
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-master