apiVersion: apps/v1 kind: Deployment metadata: name: api-gateway namespace: api labels: app: api-gateway component: gateway spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app: api-gateway template: metadata: labels: app: api-gateway component: gateway annotations: prometheus.io/scrape: "true" prometheus.io/port: "8080" prometheus.io/path: "/metrics" spec: serviceAccountName: api-gateway securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 1000 containers: - name: gateway image: ghcr.io/riotpiaole/api-gateway:latest imagePullPolicy: Always ports: - name: http containerPort: 8080 protocol: TCP env: - name: LISTEN_ADDR value: "0.0.0.0:8080" - name: CONFIG_PATH value: "/etc/gateway/config.yaml" - name: SHUTDOWN_TIMEOUT value: "5m" - name: LOG_LEVEL value: "info" volumeMounts: - name: config mountPath: /etc/gateway readOnly: true livenessProbe: httpGet: path: /healthz port: http scheme: HTTP initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 2 failureThreshold: 3 readinessProbe: httpGet: path: /readyz port: http scheme: HTTP initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 2 failureThreshold: 2 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 capabilities: drop: - ALL volumes: - name: config configMap: name: api-gateway-config affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - api-gateway topologyKey: kubernetes.io/hostname terminationGracePeriodSeconds: 300