我有一個Kubernetes部署,看起來像這樣(更換名稱和其他事情「......」):如何在節點之間分發部署?
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "3"
kubernetes.io/change-cause: kubectl replace deployment ....
-f - --record
creationTimestamp: 2016-08-20T03:46:28Z
generation: 8
labels:
app: ....
name: ....
namespace: default
resourceVersion: "369219"
selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/....
uid: aceb2a9e-6688-11e6-b5fc-42010af000c1
spec:
replicas: 2
selector:
matchLabels:
app: ....
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: ....
spec:
containers:
- image: gcr.io/..../....:0.2.1
imagePullPolicy: IfNotPresent
name: ....
ports:
- containerPort: 8080
protocol: TCP
resources:
requests:
cpu: "0"
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 2
observedGeneration: 8
replicas: 2
updatedReplicas: 2
我觀察的問題是,Kubernetes地方兩個副本(在部署我已經要求兩個)在同一個節點上。如果該節點關閉,則會丟失兩個容器,並且該服務將脫機。
我想讓Kubernetes做的事情是確保它不會在容器是相同類型的同一節點上加倍容器 - 這隻會消耗資源並且不會提供任何冗餘。我查看了關於部署,副本集,節點等的文檔,但是我找不到任何可以讓我告訴Kubernetes執行此操作的選項。
有沒有辦法告訴Kubernetes跨節點多少冗餘我想要一個容器?
編輯:我不確定標籤會起作用;標籤約束節點將運行的位置,以便它可以訪問本地資源(SSD)等。我所要做的就是確保節點脫機時不會停機。
我不知道標籤將工作;標籤約束節點將運行的位置,以便它可以訪問本地資源(SSD)等。我所要做的就是確保節點脫機時不會停機。 –