apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "frontend.fullname" . }} labels: {{- include "frontend.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: {{- include "frontend.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "frontend.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: frontend image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} ports: # L'image xor1234/frontend-mln (nginx) écoute en dur sur le port # 80 (voir /etc/nginx/conf.d/default.conf embarqué dans l'image) — # déjà anticipé par deploy/chart-gestion/ingressroute/values.yaml # (frontend.servicePort: 80). 8080 ici ne correspondait à rien de # réellement écouté, d'où le "connection refused" en probe. - name: http containerPort: 80 protocol: TCP volumeMounts: - name: tmp mountPath: /tmp - name: caddy-data mountPath: /data - name: app-config mountPath: /srv/config.js subPath: config.js readOnly: true # readOnlyRootFilesystem:true (voir securityContext) empêche # nginx de créer /var/cache/nginx/client_temp au démarrage # ("mkdir() ... failed (30: Read-only file system)", CrashLoop) — # nginx a besoin d'y écrire même quand il ne sert que du # contenu statique. - name: nginx-cache mountPath: /var/cache/nginx - name: nginx-run mountPath: /var/run livenessProbe: httpGet: path: / port: http initialDelaySeconds: 10 periodSeconds: 30 readinessProbe: httpGet: path: / port: http initialDelaySeconds: 5 periodSeconds: 10 resources: {{- toYaml .Values.resources | nindent 12 }} volumes: - name: tmp emptyDir: {} - name: caddy-data emptyDir: {} - name: nginx-cache emptyDir: {} - name: nginx-run emptyDir: {} - name: app-config configMap: name: {{ include "frontend.fullname" . }}-config