pokeapi/Resources/k8s/kustomize/deployments/pokeapi-deployment.yaml

63 lines
1.8 KiB
YAML
Raw Normal View History

2021-05-27 17:25:40 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: pokeapi
labels:
component: pokeapi
spec:
replicas: 2
selector:
matchLabels:
component: pokeapi
template:
metadata:
labels:
component: pokeapi
spec:
initContainers:
- name: postgres-connection-checker
image: postgres:13.3-alpine
command: ['sh', '-c',
'until pg_isready -h postgresql -p 5432;
do echo waiting for database; sleep 2; done;']
containers:
- name: pokeapi
image: pokeapi/pokeapi:staging
ports:
2021-05-28 09:53:23 +00:00
- containerPort: 8080
securityContext: # CI: Github Actions kills this container if not run with root. Otherwise, it's safe to use the default pokeapi/pokeapi user and remove these lines.
2021-05-28 13:50:42 +00:00
allowPrivilegeEscalation: false
runAsUser: 0
2021-05-27 17:25:40 +00:00
env:
2021-05-28 09:53:23 +00:00
- name: SERVER_PORT
2021-05-28 13:50:42 +00:00
value: "8080"
2021-05-27 17:25:40 +00:00
- name: POSTGRES_HOST
value: postgresql
- name: POSTGRES_USER
value: ash
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-env-secret
key: POSTGRES_PASSWORD
- name: POSTGRES_DB
value: pokeapi
- name: REDIS_CONNECTION_STRING
value: redis://redis:6379/1
envFrom:
- configMapRef:
name: pokeapi-configmap
resources: {}
readinessProbe:
periodSeconds: 5
initialDelaySeconds: 5
httpGet:
path: /api/v2/
2021-05-28 13:50:42 +00:00
port: 8080
2021-05-27 17:25:40 +00:00
livenessProbe:
periodSeconds: 5
initialDelaySeconds: 5
httpGet:
path: /api/v2/
2021-05-28 13:50:42 +00:00
port: 8080