# Production-Ready Deployment Template # Customize values marked with apiVersion: apps/v1 kind: Deployment metadata: name: labels: app: version: v1 spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app: template: metadata: labels: app: version: v1 annotations: prometheus.io/scrape: "true" prometheus.io/port: "8080" prometheus.io/path: "/metrics" spec: serviceAccountName: securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 1000 affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchLabels: app: topologyKey: kubernetes.io/hostname containers: - name: image: : imagePullPolicy: Always ports: - name: http containerPort: 8080 protocol: TCP env: - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace envFrom: - configMapRef: name: -config - secretRef: name: -secrets resources: requests: memory: "256Mi" cpu: "250m" limits: memory: "512Mi" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false capabilities: drop: - ALL livenessProbe: httpGet: path: /healthz port: http initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: /ready port: http initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 volumeMounts: - name: tmp mountPath: /tmp - name: cache mountPath: /var/cache volumes: - name: tmp emptyDir: {} - name: cache emptyDir: {} terminationGracePeriodSeconds: 30 --- apiVersion: v1 kind: Service metadata: name: labels: app: spec: type: ClusterIP ports: - port: 80 targetPort: http protocol: TCP name: http selector: app: --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: minReplicas: 3 maxReplicas: 10 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 --- apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: spec: minAvailable: 2 selector: matchLabels: app: