我有這個用于 kubernetes 的 deployment.yaml
---
apiVersion: v1
kind: Service
metadata:
name: smart-flats
labels:
app: smart-flats
spec:
type: NodePort
selector:
app: smart-flats
ports:
- protocol: TCP
port: 5000
name: http
---
apiVersion: v1
kind: ReplicationController
metadata:
name: smart-flats
spec:
replicas: 1
template:
metadata:
labels:
app: smart-flats
spec:
containers:
- name: smart-flats
image: sleezy/go-hello-world:<VERSION>
env:
- name: SECRETKEY
value: "${CONFIG_SECRETKEY}"
ports:
- containerPort: 5000
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 30
timeoutSeconds: 1
但是當我嘗試推送新版本的應用程式時,kubectl get pods 仍然顯示第一個并且沒有更新版本,我該怎么辦?我每次推送新版本時都需要更新 pod。謝謝!
uj5u.com熱心網友回復:
kind: Deployment建議使用First off而不是kind: ReplicationController,請參閱此處了解詳細資訊。更新規范后,您可以使用kubectl set image deployment smart-flats smart-flats=sleezy/go-hello-world:<new version>. 您的 Pod 將使用新的鏡像版本自動重啟。
uj5u.com熱心網友回復:
ReplicationController 確保在任何時間運行指定數量的 pod 副本。他們不直接支持滾動更新。簡單來說,他們只會查看維護指定數量的 pod,不會監控 pod 的鏡像版本。
在將更改推送到復制控制器后,只需洗掉現有/舊 pod,即可使用修改后的/新映像運行 pod。將使用新影像創建新 pod。[或者]
因為@gohm'c 建議部署而不是副本集或復制控制器將是更好的選擇。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/377086.html
