Skip to content

Commit 2abfbf0

Browse files
[8.x](backport #7274) [Helm] support creating priority class (#7313)
* [Helm] support creating priority class (#7274) * feat: support defining priority class for agent presets * feat: add example for priority class (cherry picked from commit a1768ae) # Conflicts: # deploy/helm/elastic-agent/templates/agent/eck/_pod_template.yaml # deploy/helm/elastic-agent/templates/agent/k8s/_pod_template.yaml * fix: update helm examples --------- Co-authored-by: Panos Koutsovasilis <[email protected]>
1 parent db18e20 commit 2abfbf0

File tree

13 files changed

+1372
-6
lines changed

13 files changed

+1372
-6
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kubernetes:
2+
enabled: true
3+
4+
agent:
5+
unprivileged: true
6+
presets:
7+
perNode:
8+
priorityClass:
9+
create: true
10+
value: 456
11+
globalDefault: true
12+
preemptionPolicy: "Never"
13+
description: "Elastic Agent per-node preset priority class"
14+
clusterWide:
15+
priorityClass:
16+
create: false
17+
name: "agent-clusterwide-pc"

0 commit comments

Comments
 (0)