提交 862bd148 编写于 作者: 阳明的博客's avatar 阳明的博客

[add] 添加亲和性调度

上级 01df401d
......@@ -77,4 +77,4 @@
### 调度器
* [Kubernetes 调度器介绍](docs/50.Kubernetes调度策略.md)
* [Kubernetes 亲和性调度](docs/51.Kubernetes亲和性调度.md)
\ No newline at end of file
* [Kubernetes 亲和性调度](docs/51.Kubernetes亲和性调度.md)
......@@ -66,10 +66,10 @@
"bookmark": "favicon.ico"
},
"3-ba": {
"token": "98a42f33a08c40eef600d39d605ab818"
"token": "d611849735f187dd788dc054908f7d7a"
},
"ga": {
"token": "UA-69668147-7"
"token": "UA-69668147-3"
}
}
}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: affinity
labels:
app: affinity
spec:
replicas: 3
revisionHistoryLimit: 10
template:
metadata:
labels:
app: affinity
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- name: http
containerPort: 80
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: NotIn
values:
- node03
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: com
operator: In
values:
- youdianzhishi
apiVersion: v1
kind: Pod
metadata:
labels:
app: busybox-pod
name: test-busybox
spec:
containers:
- command:
- sleep
- "3600"
image: busybox
name: test-busybox
nodeSelector:
com: youdianzhishi
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: affinity
labels:
app: affinity
spec:
replicas: 3
revisionHistoryLimit: 10
template:
metadata:
labels:
app: affinity
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- name: http
containerPort: 80
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- busybox-pod
topologyKey: kubernetes.io/hostname
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: affinity
labels:
app: affinity
spec:
replicas: 3
revisionHistoryLimit: 10
template:
metadata:
labels:
app: affinity
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- name: http
containerPort: 80
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- busybox-pod
topologyKey: kubernetes.io/hostname
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册