Skip to content

Commit 7c6971d

Browse files
[8.16](backport #5854) [helm]: implement support for defining image pull secrets (#5880)
* [helm]: implement support for defining image pull secrets (#5854) * feat: implement support for defining image pull secrets * doc: add imagePullSecrets in kubernetes default example (cherry picked from commit 053b320) # Conflicts: # deploy/helm/elastic-agent/values.yaml * fix: merge conflicts --------- Co-authored-by: Panos Koutsovasilis <[email protected]>
1 parent 861d3e0 commit 7c6971d

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

deploy/helm/elastic-agent/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ The chart built-in [kubernetes integration](https://docs.elastic.co/integrations
133133
|-----|------|---------|-------------|
134134
| agent.version | string | `"9.0.0"` | elastic-agent version |
135135
| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"docker.elastic.co/beats/elastic-agent","tag":"9.0.0-SNAPSHOT"}` | image configuration |
136+
| agent.imagePullSecrets | list | `[]` | image pull secrets |
136137
| agent.engine | string | `"k8s"` | generate kubernetes manifests or [ECK](https://github.com/elastic/cloud-on-k8s) CRDs |
137138
| agent.unprivileged | bool | `false` | enable unprivileged mode |
138139
| 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) |

deploy/helm/elastic-agent/examples/kubernetes-default/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,30 @@ In this example we install the built-in `kubernetes` integration with the defaul
1313
2. `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))
1414

1515
## Run:
16+
17+
#### Public image registry:
1618
```console
1719
helm install elastic-agent ../../ \
1820
-f ./agent-kubernetes-values.yaml \
1921
--set outputs.default.type=ESSecretAuthAPI \
2022
--set outputs.default.secretName=es-api-secret
2123
```
2224

25+
26+
#### Private image registry:
27+
Create secret with the contents of docker auth config
28+
```
29+
kubectl create secret generic regcred --from-file=.dockerconfigjson=<your home folder here>/.docker/config.json --type=kubernetes.io/dockerconfigjson
30+
```
31+
32+
Install elastic-agent
33+
```console
34+
helm install elastic-agent ../../ \
35+
-f ./agent-kubernetes-values.yaml \
36+
--set 'agent.imagePullSecrets[0].name=regcred' \
37+
--set outputs.default.type=ESSecretAuthAPI \
38+
--set outputs.default.secretName=es-api-secret
39+
2340
## Validate:
2441

2542
1. The Kibana `kubernetes`-related dashboards should start showing up the respective info.

deploy/helm/elastic-agent/templates/agent/eck/_pod_template.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
initContainers:
3737
{{- . | toYaml | nindent 10 }}
3838
{{- end }}
39+
{{- with $.Values.agent.imagePullSecrets }}
40+
imagePullSecrets:
41+
{{- . | toYaml | nindent 10 }}
42+
{{- end }}
3943
containers:
4044
{{- with ($presetVal).extraContainers }}
4145
{{- . | toYaml | nindent 10 }}

deploy/helm/elastic-agent/templates/agent/k8s/_pod_template.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
initContainers:
6464
{{- . | toYaml | nindent 8 }}
6565
{{- end }}
66+
{{- with $.Values.agent.imagePullSecrets }}
67+
imagePullSecrets:
68+
{{- . | toYaml | nindent 8 }}
69+
{{- end }}
6670
containers:
6771
{{- with ($presetVal).extraContainers }}
6872
{{- . | toYaml | nindent 8 }}

deploy/helm/elastic-agent/values.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@
268268
"image": {
269269
"$ref": "#/definitions/AgentImageConfig"
270270
},
271+
"imagePullSecrets": {
272+
"type": "array",
273+
"items": {
274+
"type": "object"
275+
}
276+
},
271277
"engine": {
272278
"type": "string",
273279
"enum": [

deploy/helm/elastic-agent/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ agent:
301301
repository: docker.elastic.co/beats/elastic-agent
302302
pullPolicy: IfNotPresent
303303
tag: "8.16.0-SNAPSHOT"
304+
# -- image pull secrets
305+
# @section -- 3 - Elastic-Agent Configuration
306+
imagePullSecrets: []
304307
# -- generate kubernetes manifests or [ECK](https://github.com/elastic/cloud-on-k8s) CRDs
305308
# @section -- 3 - Elastic-Agent Configuration
306309
engine: k8s # k8s or eck

0 commit comments

Comments
 (0)