|
| 1 | +# Example: Kubernetes Integration with default chart values |
| 2 | + |
| 3 | +In this example we install the built-in `kubernetes` integration with the default built-in values and we adjust the priority class of the two built-in presets, namely `perNode` and `clusterWide`. |
| 4 | + |
| 5 | +## Chart Values |
| 6 | + |
| 7 | +Below we showcase how to adjust the priority class of the two built-in presets, namely `perNode` and `clusterWide`. |
| 8 | + |
| 9 | +```yaml |
| 10 | +# part of values.yaml |
| 11 | +agent: |
| 12 | + presets: |
| 13 | + perNode: |
| 14 | + priorityClass: |
| 15 | + create: true # instruct helm to create this priority class |
| 16 | + value: 456 |
| 17 | + globalDefault: true |
| 18 | + preemptionPolicy: "Never" |
| 19 | + description: "Elastic Agent per-node preset priority class" |
| 20 | + clusterWide: |
| 21 | + priorityClass: |
| 22 | + create: false # instruct helm to use a pre-existing priority class |
| 23 | + name: "agent-clusterwide-pc" |
| 24 | +``` |
| 25 | +
|
| 26 | +## Prerequisites: |
| 27 | +1. Build the dependencies of the Helm chart |
| 28 | + ```console |
| 29 | + helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 30 | + helm dependency build ../../ |
| 31 | + ``` |
| 32 | +2. A k8s secret that contains the connection details to an Elasticsearch cluster such as the URL and the API key ([Kibana - Creating API Keys](https://www.elastic.co/guide/en/kibana/current/api-keys.html)): |
| 33 | + ```console |
| 34 | + kubectl create secret generic es-api-secret \ |
| 35 | + --from-literal=api_key=... \ |
| 36 | + --from-literal=url=... |
| 37 | + ``` |
| 38 | + |
| 39 | +3. `kubernetes` integration assets installed through Kibana ([Kibana - Install and uninstall Elastic Agent integration assets](https://www.elastic.co/guide/en/fleet/current/install-uninstall-integration-assets.html)) |
| 40 | + |
| 41 | +## Run: |
| 42 | + |
| 43 | +#### Public image registry: |
| 44 | +```console |
| 45 | +helm install elastic-agent ../../ \ |
| 46 | + -f ./values.yaml \ |
| 47 | + --set outputs.default.type=ESSecretAuthAPI \ |
| 48 | + --set outputs.default.secretName=es-api-secret |
| 49 | +``` |
| 50 | + |
| 51 | + |
| 52 | +#### Private image registry: |
| 53 | +Create secret with the contents of docker auth config |
| 54 | +``` |
| 55 | +kubectl create secret generic regcred --from-file=.dockerconfigjson=<your home folder here>/.docker/config.json --type=kubernetes.io/dockerconfigjson |
| 56 | +``` |
| 57 | +
|
| 58 | +Install elastic-agent |
| 59 | +```console |
| 60 | +helm install elastic-agent ../../ \ |
| 61 | + -f ./agent-kubernetes-values.yaml \ |
| 62 | + --set 'agent.imagePullSecrets[0].name=regcred' \ |
| 63 | + --set outputs.default.type=ESSecretAuthAPI \ |
| 64 | + --set outputs.default.secretName=es-api-secret |
| 65 | +``` |
| 66 | + |
| 67 | +## Validate: |
| 68 | + |
| 69 | +1. `kube-state metrics` is installed with this command `kubectl get deployments -n kube-system kube-state-metrics`. |
| 70 | +2. The Kibana `kubernetes`-related dashboards should start showing up the respective info. |
| 71 | + |
| 72 | +## Note: |
| 73 | + |
| 74 | +1. If you want to disable kube-state-metrics installation with the elastic-agent Helm chart, you can set `kube-state-metrics.enabled=false` in the Helm chart. The helm chart will use the value of `kubernetes.state.host` to configure the elastic-agent input. |
0 commit comments