apiVersion: apps/v1 kind: Deployment metadata: namespace: dev name: app labels: app: app spec: replicas: 3 selector: matchLabels: app: app template: metadata: labels: app: app spec: initContainers: - name: init image: eu.gcr.io/project/init imagePullPolicy: Always command: ['sh', '-c', 'cp -r /app /srv; chown -R 82:82 /srv/app'] volumeMounts: - name: code mountPath: /srv containers: - name: nginx image: eu.gcr.io/project/nginx imagePullPolicy: Always ports: - containerPort: 80 volumeMounts: - name: code mountPath: /srv - name: php-socket mountPath: /var/run livenessProbe: httpGet: path: /health.html port: 80 httpHeaders: - name: X-Healthcheck value: Checked initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 15 readinessProbe: httpGet: path: /health.html port: 80 httpHeaders: - name: X-Healthcheck value: Checked initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 15 - name: php image: eu.gcr.io/project/php imagePullPolicy: Always volumeMounts: - name: code mountPath: /srv - name: php-socket mountPath: /var/run livenessProbe: httpGet: path: /health.html port: 80 httpHeaders: - name: X-Healthcheck value: Checked initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 15 readinessProbe: httpGet: path: /health.html port: 80 httpHeaders: - name: X-Healthcheck value: Checked initialDelaySeconds: 10 timeoutSeconds: 1 periodSeconds: 15 volumes: - name: code emptyDir: {} - name: php-socket emptyDir: {} --- apiVersion: v1 kind: Service metadata: namespace: dev name: app-service spec: type: LoadBalancer ports: - port: 80 targetPort: 80 protocol: TCP selector: app: app