|
| 1 | +# Example: Kubernetes Integration with default chart values and onboarding-id |
| 2 | + |
| 3 | +In this example we install the built-in `kubernetes` integration with the default built-in values and an onboarding-id for quick-start flows . |
| 4 | + |
| 5 | +## Prerequisites: |
| 6 | +1. Build the dependencies of the Helm chart |
| 7 | + ```console |
| 8 | + helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 9 | + helm dependency build ../../ |
| 10 | + ``` |
| 11 | +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)): |
| 12 | + ```console |
| 13 | + kubectl create secret generic es-api-secret \ |
| 14 | + --from-literal=api_key=... \ |
| 15 | + --from-literal=url=... |
| 16 | + ``` |
| 17 | + |
| 18 | +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)) |
| 19 | + |
| 20 | +## Run: |
| 21 | + |
| 22 | +#### Public image registry: |
| 23 | +```console |
| 24 | +helm install elastic-agent ../../ \ |
| 25 | + --set kubernetes.onboardingID: "my-onboarding-id" |
| 26 | + --set kubernetes.enabled: true \ |
| 27 | + --set agent.unprivileged: true \ |
| 28 | + --set outputs.default.type=ESSecretAuthAPI \ |
| 29 | + --set outputs.default.secretName=es-api-secret |
| 30 | +``` |
| 31 | + |
| 32 | + |
| 33 | +#### Private image registry: |
| 34 | +Create secret with the contents of docker auth config |
| 35 | +``` |
| 36 | +kubectl create secret generic regcred --from-file=.dockerconfigjson=<your home folder here>/.docker/config.json --type=kubernetes.io/dockerconfigjson |
| 37 | +``` |
| 38 | + |
| 39 | +Install elastic-agent |
| 40 | +```console |
| 41 | +helm install elastic-agent ../../ \ |
| 42 | + --set kubernetes.onboardingID: "my-onboarding-id" |
| 43 | + --set kubernetes.enabled: true \ |
| 44 | + --set agent.unprivileged: true \ |
| 45 | + --set 'agent.imagePullSecrets[0].name=regcred' \ |
| 46 | + --set outputs.default.type=ESSecretAuthAPI \ |
| 47 | + --set outputs.default.secretName=es-api-secret |
| 48 | +``` |
| 49 | + |
| 50 | +## Validate: |
| 51 | + |
| 52 | +1. `kube-state metrics` is installed with this command `kubectl get deployments -n kube-system kube-state-metrics`. |
| 53 | +2. The Kibana `kubernetes`-related dashboards should start showing up the respective info. |
| 54 | + |
| 55 | +## Note: |
| 56 | + |
| 57 | +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