123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
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