deployment.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: auto-put-ad-mini
  5. namespace: ad-automation
  6. labels:
  7. app: auto-put-ad-mini
  8. version: v1.0.0
  9. spec:
  10. replicas: 1 # 单实例运行(避免并发冲突)
  11. selector:
  12. matchLabels:
  13. app: auto-put-ad-mini
  14. template:
  15. metadata:
  16. labels:
  17. app: auto-put-ad-mini
  18. version: v1.0.0
  19. spec:
  20. containers:
  21. - name: decision-engine
  22. image: your-registry/auto-put-ad-mini:latest
  23. imagePullPolicy: Always
  24. ports:
  25. - containerPort: 8080
  26. name: http
  27. protocol: TCP
  28. envFrom:
  29. - configMapRef:
  30. name: ad-config
  31. - secretRef:
  32. name: ad-secrets
  33. env:
  34. - name: CRON_SCHEDULE
  35. value: "0 2 * * *" # 每天凌晨2点UTC
  36. - name: RUN_ON_STARTUP
  37. value: "false" # 启动时不立即执行
  38. - name: PORT
  39. value: "8080"
  40. volumeMounts:
  41. - name: outputs
  42. mountPath: /app/outputs
  43. livenessProbe:
  44. httpGet:
  45. path: /health
  46. port: 8080
  47. initialDelaySeconds: 30
  48. periodSeconds: 30
  49. timeoutSeconds: 10
  50. failureThreshold: 3
  51. readinessProbe:
  52. httpGet:
  53. path: /health
  54. port: 8080
  55. initialDelaySeconds: 10
  56. periodSeconds: 10
  57. timeoutSeconds: 5
  58. failureThreshold: 3
  59. resources:
  60. requests:
  61. memory: "1Gi"
  62. cpu: "500m"
  63. limits:
  64. memory: "2Gi"
  65. cpu: "1"
  66. securityContext:
  67. runAsNonRoot: true
  68. runAsUser: 1000
  69. allowPrivilegeEscalation: false
  70. volumes:
  71. - name: outputs
  72. persistentVolumeClaim:
  73. claimName: ad-outputs-pvc
  74. ---
  75. apiVersion: v1
  76. kind: Service
  77. metadata:
  78. name: auto-put-ad-mini
  79. namespace: ad-automation
  80. labels:
  81. app: auto-put-ad-mini
  82. spec:
  83. selector:
  84. app: auto-put-ad-mini
  85. ports:
  86. - name: http
  87. port: 8080
  88. targetPort: 8080
  89. protocol: TCP
  90. type: ClusterIP