Creating a new cluster with ECK
-
Create a file named
cluster.yaml
and add the following content:apiVersion: elasticsearch.k8s.elastic.co/v1 kind: Elasticsearch metadata: name: siren spec: # The Elasticsearch version version: 7.17.6 nodeSets: - name: default # The number of nodes count: 1 # This section defines the persistent volume that will be used to store the node data and its size. # For more information about storage options see https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-storage-recommendations.html volumeClaimTemplates: - metadata: name: elasticsearch-data # Do not change this name unless you set up a volume mount for the data path. spec: accessModes: - ReadWriteOnce resources: requests: storage: 4Gi storageClassName: standard podTemplate: spec: initContainers: # This privileged container will set vm.max_map_count on the worker - name: sysctl securityContext: privileged: true runAsUser: 0 command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144'] # This container downloads and installs Siren Federate. Make sure to set # the URL to a version of Federate compatible with your Elasticsearch version. # All versions are listed at https://siren.io/downloads/?product=siren-federate - name: federate command: - sh - -c - | bin/elasticsearch-plugin install -b https://download.support.siren.io/federate/7.17.6-28.1.zip containers: # This is the definition of the main container running Elasticsearch. # Make sure to set the CPU and memory requests and limits to an amount # allowed by your available workers. - name: elasticsearch resources: requests: memory: 4Gi cpu: 2 limits: memory: 4Gi cpu: 2
If your cluster does not allow the execution of privileged containers, set the kernel parameter vm.max_map_count to 262144 on the workers and remove the
sysctl
container from the manifest. -
Create a namespace to host this cluster,
kubectl create namespace <namespace>
, for example:kubectl create namespace siren
-
Apply the operator configuration to the namespace:
kubectl -n siren apply -f cluster.yaml
-
Get the status of the cluster:
kubectl -n siren get elasticsearch/siren
After a few attempts the cluster should get to the ready phase:
NAME HEALTH NODES VERSION PHASE AGE siren green 1 7.17.6 Ready 17m
If the cluster does not get to the ready phase, you can get extra information about the status of the deployment with
kubectl describe
, for example:kubectl -n siren describe elasticsearch/siren
Connecting to the cluster
ECK creates a service to expose the HTTP port of the cluster named <cluster name>-es-http
.
To connect to the service, forward its port to your machine, for example:
kubectl -n siren port-forward service/siren-es-http 9200
You can now connect to https://localhost:9200
. However, your browser will give a warning because it uses a TLS certificate from an automatically generated CA.
Next steps
To initialize the security configuration of the cluster see Loading the security configuration.