Skip to content

Commit

Permalink
[8.x](backport #6495) [helm] add kube-state-metric subchart dependency (
Browse files Browse the repository at this point in the history
#6534)

* [helm] add kube-state-metric subchart dependency (#6495)

* feat: add ksm subchart dependency

* feat: refactor elastic-agent chart to utilise ksm subchart

* feat: add new ksm examples

* fix: typos

* feat: remove charts directory

* fix: reintroduce Chart.lock

(cherry picked from commit edd342a)

# Conflicts:
#	deploy/helm/elastic-agent/Chart.yaml
#	deploy/helm/elastic-agent/examples/eck/rendered/manifest.yaml
#	deploy/helm/elastic-agent/examples/kubernetes-default/rendered/manifest.yaml
#	deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml
#	deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml
#	deploy/helm/elastic-agent/examples/user-service-account/rendered/manifest.yaml

* fix: update chart.yaml and examples for 8.x

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
  • Loading branch information
mergify[bot] and pkoutsovasilis authored Jan 17, 2025
1 parent 3a9c7b8 commit 949bf59
Show file tree
Hide file tree
Showing 80 changed files with 4,603 additions and 4,204 deletions.
1 change: 1 addition & 0 deletions deploy/helm/elastic-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./charts
6 changes: 6 additions & 0 deletions deploy/helm/elastic-agent/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: kube-state-metrics
repository: https://prometheus-community.github.io/helm-charts
version: 5.28.0
digest: sha256:906b95867021d3a0a7edd170f9986ddea15e452974bf5898e6dd987e3822eeb9
generated: "2025-01-15T13:09:49.199939+02:00"
5 changes: 5 additions & 0 deletions deploy/helm/elastic-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ kubeVersion: ">= 1.27.0-0"
type: application
appVersion: 8.18.0
version: 8.18.0-beta
dependencies:
- name: kube-state-metrics
version: "5.28.0"
repository: https://prometheus-community.github.io/helm-charts
condition: kube-state-metrics.enabled
13 changes: 7 additions & 6 deletions deploy/helm/elastic-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# elastic-agent

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 8.18.0-beta](https://img.shields.io/badge/Version-8.18.0--beta-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.18.0](https://img.shields.io/badge/AppVersion-8.18.0-informational?style=flat-square)

Elastic-Agent Helm Chart

Expand Down Expand Up @@ -67,8 +67,9 @@ The chart built-in [kubernetes integration](https://docs.elastic.co/integrations
| kubernetes.namespace | string | `"default"` | kubernetes namespace |
| kubernetes.hints.enabled | bool | `false` | enable [elastic-agent autodiscovery](https://www.elastic.co/guide/en/fleet/current/elastic-agent-kubernetes-autodiscovery.html) feature |
| kubernetes.state.enabled | bool | `true` | integration global switch to enable state streams based on kube-state-metrics. Note that setting this to `false` results in overriding and *disabling all* the respective state streams |
| kubernetes.state.deployKSM | bool | `true` | deploy kube-state-metrics service as a sidecar container to the elastic agent of `ksmSharded` preset. If set to `false`, kube-state-metrics will *not* get deployed and `clusterWide` agent preset will be used for collecting kube-state-metrics. |
| kubernetes.state.host | string | `"kube-state-metrics:8080"` | host of the kube-state-metrics service. Note that this used only when `deployKSM` is set to `false`. |
| kubernetes.state.agentAsSidecar.enabled | bool | `false` | enable [ksm autosharding](https://github.com/kubernetes/kube-state-metrics?tab=readme-ov-file#automated-sharding) and deploy elastic-agent as a sidecar container. If `kube-state-metrics.enabled` is set to `false` this has no effect. |
| kubernetes.state.agentAsSidecar.resources | object | `{"limits":{"memory":"800Mi"},"requests":{"cpu":"100m","memory":"400Mi"}}` | resources of the elastic-agent sidecar if `agentAsSidecar.enabled` is set to `true` |
| kubernetes.state.host | string | `"kube-state-metrics:8080"` | host of the kube-state-metrics service. This used only when `kube-state-metrics.enabled` is set to `false`. |
| kubernetes.state.vars | object | `{}` | state streams variables such as `add_metadata`, `hosts`, `period`, `bearer_token_file`. Please note that colliding vars also defined in respective state streams will *not* be overridden. |
| kubernetes.metrics.enabled | bool | `true` | integration global switch to enable metric streams based on kubelet. Note that setting this to false results in overriding and *disabling all* the respective metric streams |
| kubernetes.metrics.vars | object | `{}` | metric streams variables such as `add_metadata`, `hosts`, `period`, `bearer_token_file`, `ssl.verification_mode`. Please note that colliding vars also defined in respective metric streams will *not* be overridden. |
Expand Down Expand Up @@ -143,12 +144,12 @@ The chart built-in [kubernetes integration](https://docs.elastic.co/integrations
### 6 - Elastic-Agent Configuration
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| agent.version | string | `"9.0.0"` | elastic-agent version |
| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"docker.elastic.co/beats/elastic-agent","tag":"9.0.0-SNAPSHOT"}` | image configuration |
| agent.version | string | `"8.18.0"` | elastic-agent version |
| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"docker.elastic.co/beats/elastic-agent","tag":"8.18.0-SNAPSHOT"}` | image configuration |
| agent.imagePullSecrets | list | `[]` | image pull secrets |
| agent.engine | string | `"k8s"` | generate kubernetes manifests or [ECK](https://github.com/elastic/cloud-on-k8s) CRDs |
| agent.unprivileged | bool | `false` | enable unprivileged mode |
| agent.presets | map[string]{} | `{ "perNode" : {...}, "clusterWide": {...}, "ksmSharded": {...} }` | Map of deployment presets for the Elastic Agent. The key of the map is the name of the preset. See more for the presets required by the built-in Kubernetes integration [here](./values.yaml) |
| agent.presets | map[string]{} | `{ "perNode" : {...}, "clusterWide": {...}}` | Map of deployment presets for the Elastic Agent. The key of the map is the name of the preset. See more for the presets required by the built-in Kubernetes integration [here](./values.yaml) |

### 6.1 - Elastic-Agent Managed Configuration
| Key | Type | Default | Description |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/elastic-agent/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
Here is a collection of example configurations for the eck-integrations chart.

- [Kubernetes - defaults](kubernetes-default/README.md)
- [Kubernetes - KSM autosharding](kubernetes-ksm-sharding/README.md)
- [System - custom authlogs path](kubernetes-default/README.md)
- [Kubernetes - only container logs](kubernetes-only-logs/README.md)
- [Kubernetes - only hints autodiscover](kubernetes-hints-autodiscover/README.md)
- [Nginx - custom integration](nginx-custom-integration/README.md)
- [Multiple Integrations](multiple-integrations/README.md)
- [ECK - Kubernetes - defaults](eck/README.md)
- [Fleet - Managed Agent](fleet-managed/README.md)
- [Fleet - Managed Agent with KSM autosharding](fleet-managed-ksm-sharding/README.md)
- [User created cluster role](user-cluster-role/README.md)
- [User created service account](user-service-account/README.md)

Expand Down
8 changes: 7 additions & 1 deletion deploy/helm/elastic-agent/examples/eck/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ In this example we install the built-in `kubernetes` integration with the defaul

1. The username to connect to Kibana is `elastic`
2. To find the password to connect to Kibana, run `kubectl get secrets/elasticsearch-sample-es-elastic-user -n elastic-system -o json | jq -r '.data.elastic' | base64 -d`
3. Don't forget to forward the port of Kibana to your local machine by running `kubectl port-forward deployments/kibana-sample-kb -n elastic-system 12000:5601`
3. Don't forget to forward the port of Kibana to your local machine with this command `kubectl port-forward deployments/kibana-sample-kb -n elastic-system 12000:5601`
4. Open https://localhost:12000 in your browser
5. Install kubernetes integration through Kibana

4. Build the dependencies of the Helm chart
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm dependency build ../../
```

## Run:
```console
helm install elastic-agent ../../ \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
kubernetes:
enabled: true
state:
agentAsSidecar:
enabled: false # deploying elastic-agent with ECK as sidecar container is not supported

kube-state-metrics:
enabled: true

agent:
unprivileged: true
Expand Down
Loading

0 comments on commit 949bf59

Please sign in to comment.