Deploying Elasticsearch on Kubernetes Using the Operator
The cpu request value directly afffects the Elasticsearch node.processors configuraton. For example, with resources.requests.cpu: 1, Elasticsearch effectively uses a single core.
Table 1. Default resource limits set by the operator
| Type | Requests | Limits |
|---|---|---|
| APM Server | 512Mi | 512Mi |
| Elasticsearch | 2Gi | 2Gi |
| Kibana | 1Gi | 1Gi |
| Beat | 200Mi | 200Mi |
| Elastic Agent | 350Mi | 350Mi |
| Elastic Maps Server | 200Mi | 200Mi |
| Enterprise Search | 4Gi | 4Gi |
Installation steps:
-
Install custom resource definitions:
kubectl create -f https://download.elastic.co/downloads/eck/2.1.0/crds.yamlThe following custom resources are created:
customresourcedefinition.apiextensions.k8s.io/agents.agent.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/apmservers.apm.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/beats.beat.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticmapsservers.maps.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticsearches.elasticsearch.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/enterprisesearches.enterprisesearch.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/kibanas.kibana.k8s.elastic.co created -
Install the operator along with its access controls:
kubectl apply -f https://download.elastic.co/downloads/eck/2.1.0/operator.yamlBy default, the ECK operator runs in the
elastic-systemnamespace. It is advised to use a dedicated namespace for your workloads instead ofelastic-systemordefault. -
Monitor the operator logs:
kubectl -n elastic-system logs -f statefulset.apps/elastic-operator
The installation process performs the following actions:
- Creates
CustomResourceDefinitionobjects for all supported types (Elasticsearch, Kibana, APM Server, Enterprise Search, Beats, Elastic Agent, and Elastic Maps Server). - Sets up a
Namespacecalledelastic-systemto store all operator-related resources. - Adds a
ServiceAccount,ClusterRole, andClusterRoleBindingto allow the operator to manage cluster-wide resources. - Installs a
ValidatingWebhookConfigurationto validate Elastic custom resources upon admission. - Deploys a
StatefulSet,ConfigMap,Secret, andServicewithin theelastic-systemnamespace to run the operator application.
Uninstallation steps:
-
Remove all Elastic resources across all namespaces:
kubectl get namespaces --no-headers -o custom-columns=:metadata.name \ | xargs -n1 kubectl delete elastic --all -nThis removes all underlying Elastic Stack components, including thier Pods, Secrets, Services, and more.
-
Uninstall the operator:
kubectl delete -f https://download.elastic.co/downloads/eck/2.1.0/operator.yaml kubectl delete -f https://download.elastic.co/downloads/eck/2.1.0/crds.yaml