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:15.1-alpine command: ['sh', '-c'] args: - until pg_isready -h postgresql -p 5432; do echo waiting for database; sleep 2; done; containers: - name: pokeapi image: pokeapi/pokeapi:master imagePullPolicy: Always ports: - 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. allowPrivilegeEscalation: false runAsUser: 0 env: - name: SERVER_PORT value: "8080" - 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/ port: 8080 livenessProbe: periodSeconds: 5 initialDelaySeconds: 5 httpGet: path: /api/v2/ port: 8080