-
Notifications
You must be signed in to change notification settings - Fork 201
Fix GKE autopilot reco #4490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GKE autopilot reco #4490
Changes from 3 commits
493c0cd
71a5b41
dddfb9b
7a46b4a
a7328e6
d7647a1
858590f
e8b3f8e
4506375
b296e01
8835f07
b4d0c0f
8690e6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,25 +19,57 @@ | |||||
| 1. It is recommended that each Kubernetes host’s virtual memory kernel settings be modified. Refer to [Virtual memory](virtual-memory.md). | ||||||
| 2. It is recommended that {{es}} Pods have an `initContainer` that waits for virtual memory settings to be in place. | ||||||
| 3. For Elastic Agent/Beats there are storage limitations to be considered. | ||||||
| 4. Ensure you are using a node class that is applicable for your workload by adding a `cloud.google.com/compute-class` label in a `nodeSelector`. Refer to [GKE Autopilot documentation.](https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-compute-classes). | ||||||
| 4. Ensure you are using a node class that is applicable for your workload by adding a `cloud.google.com/compute-class` label in a `nodeSelector`. Refer to [GKE Autopilot documentation](https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-compute-classes). | ||||||
|
|
||||||
| ## Ensuring virtual memory kernel settings [k8s-autopilot-setting-virtual-memory] | ||||||
|
|
||||||
| If you are intending to run production workloads on GKE Autopilot then `vm.max_map_count` should be set. The recommended way to set this kernel setting on the Autopilot hosts is with a `Daemonset` as described in the [Virtual memory](virtual-memory.md) section. You must be running at least version 1.25 when on the `regular` channel or using the `rapid` channel, which currently runs version 1.27. | ||||||
| If you are intending to run production workloads on GKE Autopilot then `vm.max_map_count` should be set. The recommended way to set this kernel setting on the Autopilot hosts depends on your ECK version: | ||||||
|
|
||||||
| ::::{warning} | ||||||
| Only use the provided `Daemonset` exactly as specified or it could be rejected by the Autopilot control plane. | ||||||
| :::: | ||||||
| * {applies_to}`eck: ga 3.0-3.1` [Use a DaemonSet](/deploy-manage/deploy/cloud-on-k8s/virtual-memory.md#k8s_using_a_daemonset_to_set_virtual_memory). You must be running at least version 1.25 when on the `regular` channel or using the `rapid` channel, which currently runs version 1.27. | ||||||
|
|
||||||
| ::::{warning} | ||||||
| Use the provided `Daemonset` exactly as specified, with a `max_map_count` value of `262144`, or it could be rejected by the Autopilot control plane. | ||||||
| :::: | ||||||
| * {applies_to}`eck: ga 3.2+` [Use a custom ComputeClass](/deploy-manage/deploy/cloud-on-k8s/virtual-memory.md#k8s_using_a_computeclass_to_set_virtual_memory). Using a custom ComputeClass allows you to set a higher value for `max_map_count` due to limitations on the `DaemonSet`. | ||||||
|
|
||||||
| ## Install the ECK Operator [k8s-autopilot-deploy-the-operator] | ||||||
|
|
||||||
| Refer to [*Install ECK*](install.md) for more information on installation options. | ||||||
|
|
||||||
| ## Deploy an {{es}} cluster [k8s-autopilot-deploy-elasticsearch] | ||||||
|
|
||||||
| Create an {{es}} cluster. If you are using the `Daemonset` described in the [Virtual memory](virtual-memory.md) section to set `max_map_count` you can add the `initContainer` below is also used to ensure the setting is set prior to starting {{es}}. | ||||||
| Create an {{es}} cluster. The information that you need to provide in your spec depends on whether you've increased your virtual memory kernel setting, and the method that you used. | ||||||
|
|
||||||
| ::::{tab-set} | ||||||
|
|
||||||
| :::{tab-item} Using a custom ComputeClass | ||||||
| If you used a custom ComputeClass to set `max_map_count`, then you need to reference the custom ComputeClass as part of your template spec. | ||||||
|
|
||||||
| ```shell subs=true | ||||||
| ```yaml subs=true | ||||||
| cat <<EOF | kubectl apply -f - | ||||||
| apiVersion: elasticsearch.k8s.elastic.co/v1 | ||||||
| kind: Elasticsearch | ||||||
| metadata: | ||||||
| name: elasticsearch-sample | ||||||
| spec: | ||||||
| version: {{version.stack}} | ||||||
| nodeSets: | ||||||
| - name: default | ||||||
| count: 1 | ||||||
| podTemplate: | ||||||
| spec: | ||||||
| nodeSelector: | ||||||
| cloud.google.com/compute-class: "elasticsearch" | ||||||
| EOF | ||||||
| ``` | ||||||
| ::: | ||||||
|
|
||||||
|
|
||||||
| :::{tab-item} Using a DaemonSet | ||||||
|
|
||||||
| If you used a DaemonSet to set `max_map_count`, you can add the following `initContainer` to ensure the setting is set prior to starting {{es}}. | ||||||
|
|
||||||
| ```yaml subs=true | ||||||
| cat <<EOF | kubectl apply -f - | ||||||
| apiVersion: elasticsearch.k8s.elastic.co/v1 | ||||||
| kind: Elasticsearch | ||||||
|
|
@@ -48,23 +80,44 @@ | |||||
| nodeSets: | ||||||
| - name: default | ||||||
| count: 1 | ||||||
| # Only uncomment the below section if you are not using the Daemonset to set max_map_count. | ||||||
| # config: | ||||||
| # node.store.allow_mmap: false | ||||||
| podTemplate: | ||||||
| spec: | ||||||
| # This init container ensures that the `max_map_count` setting has been applied before starting Elasticsearch. | ||||||
| # This is not required, but is encouraged when using the previously mentioned Daemonset to set max_map_count. | ||||||
| # This is not required, but is encouraged when using the Daemonset to set max_map_count. | ||||||
| # Do not use this if setting config.node.store.allow_mmap: false | ||||||
| initContainers: | ||||||
| - name: max-map-count-check | ||||||
| command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"] | ||||||
| command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"] | ||||||
| EOF | ||||||
| ``` | ||||||
| ::: | ||||||
| :::: | ||||||
|
|
||||||
| ### Deploy without custom virtual memory | ||||||
|
|
||||||
| If you didn't increase your virtual memory, then you need to set `node.store.allow_mmap` to `false`. | ||||||
|
|
||||||
| ```yaml subs=true | ||||||
| cat <<EOF | kubectl apply -f - | ||||||
| apiVersion: elasticsearch.k8s.elastic.co/v1 | ||||||
| kind: Elasticsearch | ||||||
| metadata: | ||||||
| name: elasticsearch-sample | ||||||
| spec: | ||||||
| version: {{version.stack}} | ||||||
| nodeSets: | ||||||
| - name: default | ||||||
| count: 1 | ||||||
| config: | ||||||
| node.store.allow_mmap: false | ||||||
| EOF | ||||||
| ``` | ||||||
| ::: | ||||||
| :::: | ||||||
|
|
||||||
| ## Deploy a standalone Elastic Agent and/or Beats [k8s-autopilot-deploy-agent-beats] | ||||||
|
|
||||||
| When running Elastic Agent and Beats within GKE Autopilot there are storage constraints to be considered. No `HostPath` volumes are allowed, which the ECK operator defaults to when unset for both `Deployments` and `Daemonsets`. Instead use [Kubernetes ephemeral volumes](https://kubernetes.io/docs/concepts/storage/ephemeral-volumes). | ||||||
| When running Elastic Agent and Beats within GKE Autopilot there are storage constraints to be considered. No `HostPath` volumes are allowed, which the ECK operator defaults to when unset for both `Deployments` and `DaemonSets`. Instead use [Kubernetes ephemeral volumes](https://kubernetes.io/docs/concepts/storage/ephemeral-volumes). | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sentence is a bit difficult to digest.... the Not sure if this sounds better or feels easier.... @pebrc, @shainaraskas , wdyt?
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will leave this alone for now as it's outside of the scope of the original issue |
||||||
|
|
||||||
| Refer to [Recipes to deploy {{es}}, {{kib}}, Elastic Fleet Server and Elastic Agent and/or Beats within GKE Autopilot](https://github.com/elastic/cloud-on-k8s/tree/main/config/recipes/autopilot). | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.