Skip to content

Commit

Permalink
[add] 添加亲和性调度
Browse files Browse the repository at this point in the history
  • Loading branch information
cnych committed Oct 19, 2018
1 parent 01df401 commit 862bd14
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 112 deletions.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@

### 调度器
* [Kubernetes 调度器介绍](docs/50.Kubernetes调度策略.md)
* [Kubernetes 亲和性调度](docs/51.Kubernetes亲和性调度.md)
* [Kubernetes 亲和性调度](docs/51.Kubernetes亲和性调度.md)
4 changes: 2 additions & 2 deletions book.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
"bookmark": "favicon.ico"
},
"3-ba": {
"token": "98a42f33a08c40eef600d39d605ab818"
"token": "d611849735f187dd788dc054908f7d7a"
},
"ga": {
"token": "UA-69668147-7"
"token": "UA-69668147-3"
}
}
}
403 changes: 294 additions & 109 deletions docs/51.Kubernetes亲和性调度.md

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions scheduler/node-affinity-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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

15 changes: 15 additions & 0 deletions scheduler/node-selector-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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
30 changes: 30 additions & 0 deletions scheduler/pod-affinity-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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
30 changes: 30 additions & 0 deletions scheduler/pod-antiaffinity-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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

0 comments on commit 862bd14

Please sign in to comment.