IMLC.ME
Search…
en-US
Helm - Pull image from private repository
Set imagePullSecrets in Helm chart

Define imagePullSecrets value

imagePullSecrets is usually defined if you generate your chart by helm create. If no, you will need to define it in values.yaml.
1
# Default values for mychart.
2
# This is a YAML-formatted file.
3
# Declare variables to be passed into your templates.
4
5
replicaCount: 1
6
7
image:
8
repository: mychart
9
pullPolicy: IfNotPresent
10
11
imagePullSecrets: []
Copied!

Update deployment template

You need to set imagePullSecrets in deployment.yaml. Again, if you create chart by helm create, thing is ready.
1
apiVersion: apps/v1
2
kind: Deployment
3
metadata:
4
...
5
spec:
6
replicas: {{ .Values.replicaCount }}
7
selector:
8
...
9
template:
10
metadata:
11
...
12
spec:
13
{{- with .Values.imagePullSecrets }}
14
imagePullSecrets:
15
{{- toYaml . | nindent 8 }}
16
{{- end }}
Copied!

Set image pull secret value in installation

1
helm install --generate-name ./mychart \
2
--set imagePullSecrets[0].name=regcred
Copied!
Last modified 1yr ago