Если идти путём Helm:
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-db-migration
labels:
chart: {{ .Release.Name }}-{{ .Chart.Version }}
test: {{ .Release.Name }}
annotations:
"
helm.sh/hook": post-install,post-upgrade
"
helm.sh/hook-weight": "1"
"
helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
spec:
containers:
- name: db-migration
image: {{ .Values.image }}
workingDir: /usr/share/nginx/html/migration/
command: ["/usr/local/bin/php"]
args : ["migrate.php"]
resources:
limits:
cpu: 1
memory: 500Mi
requests:
cpu: 1
memory: 500Mi
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
imagePullPolicy: IfNotPresent
restartPolicy: Never