【資料圖】
Recreate策略是另一種滾動更新策略,它會先刪除舊的Pod,然后再創建新的Pod。在進行滾動更新時,所有的Pod都會被同時停止,然后全部替換為新的Pod。Recreate策略的優點是可以避免新舊Pod的共存問題,但會在升級期間中斷服務。
下面是一個Recreate策略的示例:
apiVersion: apps/v1kind: Deploymentmetadata: name: nginx-deployment labels: app: nginxspec: replicas: 4 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.16 ports: - containerPort: 80 livenessProbe: httpGet: path: / port: 80 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 2 failureThreshold: 3 readinessProbe: httpGet: path: / port: 80 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 2 failureThreshold: 3 lifecycle: preStop: exec: command: ["/usr/sbin/nginx","-s","quit"]這是一個創建了4個nginx Pod的Deployment對象,每個Pod中的nginx容器都有一個存活性探針和就緒性探針,并且在終止Pod之前執行preStop鉤子,使用/usr/sbin/nginx -s quit命令關閉nginx服務器。這確保了nginx在關閉之前可以正常完成當前正在處理的請求。
中國無人駕駛技術初創公司文遠知行考慮IPO 最早于今年上市
寧德時代上半年營業收入同比增156.32% 研發投入逼近同期凈利
蘭博基尼上半年業績創紀錄 上半年生產5090輛汽車
傳特斯拉或引入另一家壓鑄機供應商 不會取消與IDRA合作
高油價有助于加速向電動汽車轉型 英國5月汽車產量同比增13%