在我的部署中,我可以設定replicas。3,但是它只啟動了一個 pod。我的理解是,kubernetes將根據需要啟動更多的pod,最多三個。
但是出于正常運行時間的考慮,我希望在任何時候都能有一個最小的 pod,并且它可能會根據需要創建更多的 pod,但絕不會將規模縮小到 3。
這在部署中是否可行?
uj5u.com熱心網友回復:
這和你做的完全一樣,你在你的Deployment中定義了3個副本。
你是否驗證了你的部署有足夠的資源?
復制的例子:
apiVersion: apps/v1
kind: Deployment
metadata: Deployment
name: nginx-deployment
標簽:
app: nginx
spec:
replicas: 3 # <------- 你想要的復制數量
選擇器:
matchLabels:/span>
app: nginx
template:
metadata: 元資料:
標簽:/span>
應用程式: nginx
spec:
容器:
- name:/span> nginx
image: nginx:1.14.2
埠:
- containerPort:/span> 80
K8S將旋轉一個新的pod,如果它可以做到意味著,如果你有足夠的資源,資源是有效的(如節點、選擇器、影像、卷、配置等等)
如果你已經定義了 3 個副本,但你仍然只得到一個副本,請檢查你的部署或你的事件。
如何查看事件
# 查看所有事件(不要指定pod名稱或命名空間)。
kubectl get events
# Get event for specific pod
kubectl describe event <pod name> --namespace <namespace>
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/330616.html
標籤:
上一篇:K8snginxingresscontroller:error:errorparsingdeploy-tls-termination.yaml:errorconvertingYAMLtoJSON
下一篇:沒有這樣的檔案或目錄:'Tensorflow/workspace/annotations\\label_map.pbtxtonJupyter為什么我的代碼不起作用?

