apiVersion: v1 kind: Service metadata: name: api spec: clusterIP: None selector: {app: api} ports: [{name: http, port: 8080, targetPort: http}] --- apiVersion: apps/v1 kind: Deployment metadata: name: api labels: {app: api} spec: replicas: 2 revisionHistoryLimit: 2 strategy: rollingUpdate: {maxSurge: 1, maxUnavailable: 0} selector: matchLabels: {app: api} template: metadata: labels: {app: api} spec: automountServiceAccountToken: false terminationGracePeriodSeconds: 35 securityContext: {runAsNonRoot: true, runAsUser: 65532, fsGroup: 65532} containers: - name: api image: vp-messenger:local imagePullPolicy: Never ports: [{name: http, containerPort: 8080}] env: - {name: APP_HOST, value: 0.0.0.0} - {name: APP_PORT, value: '8080'} - {name: PG_MAX_CONNS, value: '8'} - {name: SESSION_TTL_SECONDS, value: '3600'} - {name: GOMEMLIMIT, value: 400MiB} resources: requests: {cpu: 100m, memory: 128Mi} limits: {cpu: '1', memory: 512Mi} securityContext: allowPrivilegeEscalation: false capabilities: {drop: [ALL]} lifecycle: preStop: sleep: {seconds: 15} readinessProbe: httpGet: {path: /health/ready, port: http} periodSeconds: 1 timeoutSeconds: 2 failureThreshold: 1 livenessProbe: httpGet: {path: /health/live, port: http} periodSeconds: 5 timeoutSeconds: 2 startupProbe: httpGet: {path: /health/live, port: http} periodSeconds: 1 failureThreshold: 60 volumeMounts: [{name: credentials, mountPath: /run/secrets, readOnly: true}] volumes: - name: credentials secret: secretName: app-config defaultMode: 0440 items: - {key: database_url, path: database_url} - {key: cache_url, path: cache_url} - {key: s3_credentials, path: s3_credentials}