-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e540a4
commit f2add6e
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: go-http | ||
labels: | ||
app: go | ||
version: v1 | ||
spec: | ||
containers: | ||
- name: go-http | ||
image: leigg/hellok8s:v1 | ||
# nodeSelector: 如果和亲和性同时配置,则必须都满足 | ||
affinity: | ||
nodeAffinity: # 不会绕过污点机制 | ||
# 下面两项可以二选一,也可以同时存在 | ||
# - requiredDuringSchedulingIgnoredDuringExecution | ||
# - preferredDuringSchedulingIgnoredDuringExecution | ||
requiredDuringSchedulingIgnoredDuringExecution: # 硬性调度 | ||
nodeSelectorTerms: # 多个 matchExpressions 之间的关系是【或】关系 | ||
- matchExpressions: # 单个 matchExpressions 中的多个表达式是【且】关系 | ||
# operator 支持 In、NotIn、Exists、DoesNotExist、Gt 和 Lt | ||
- {key: disktype, operator: In, values: ["ssd"]} | ||
# preferredDuringSchedulingIgnoredDuringExecution: # 软性调度 | ||
# - weight: 1 # 相比其他 软性调度 策略的权重,范围是1-100 | ||
# preference: | ||
# - matchExpressions: | ||
# - { key: disktype, operator: In, values: [ "ssd" ] } | ||
# - weight: 5 | ||
# preference: | ||
# - matchExpressions: | ||
# - { key: cpu, operator: In, values: [ "4core" ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: go-http-podaffinity | ||
spec: | ||
containers: | ||
- name: go-http | ||
image: leigg/hellok8s:v1 | ||
# nodeSelector: 如果和亲和性同时配置,则必须都满足 | ||
affinity: | ||
# podAffinity 可以和 podAntiAffinity 同时存在 | ||
podAffinity: # pod亲和性 | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- { key: app, operator: In, values: [ "go" ] } | ||
topologyKey: kubernetes.io/os # 必须指定,它是你希望调度Pod的目标节点群共有的标签,亲和性规则也仅会在此节点群生效 | ||
# namespaces: ["dev","test"] 允许指定命名空间,不指定则是当前Pod所在的空间 | ||
# namespaceSelector: # 或者 使用标签筛选命令空间 | ||
# matchExpressions: | ||
# - key: | ||
# operator: | ||
# matchLabels: | ||
# - environment: production | ||
# preferredDuringSchedulingIgnoredDuringExecution: | ||
# - podAffinityTerm: | ||
# topologyKey: | ||
# weight: | ||
podAntiAffinity: # pod反亲和性 | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- { key: highcpu, operator: In, values: [ "true" ] } | ||
topologyKey: kubernetes.io/hostname # 反亲和性中,此key的值固定为 kubernetes.io/hostname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: go-http | ||
labels: | ||
app: go | ||
version: v1 | ||
spec: | ||
containers: | ||
- name: go-http | ||
image: leigg/hellok8s:v1 | ||
nodeSelector: | ||
disktype: ssd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 注意所有的name都只能使用 小写字母 - . 组合 | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: go-http | ||
labels: | ||
app: go | ||
version: v1 | ||
spec: | ||
containers: | ||
- name: go-http | ||
image: leigg/hellok8s:v1 | ||
nodeName: k8s-master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: go-http-master | ||
labels: | ||
app: "go" | ||
spec: | ||
nodeName: k8s-master | ||
containers: | ||
- name: go-http | ||
image: leigg/hellok8s:v1 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: go-http-node1 | ||
labels: | ||
app: "go" | ||
highcpu: "true" | ||
spec: | ||
nodeName: k8s-node1 | ||
containers: | ||
- name: go-http | ||
image: leigg/hellok8s:v1 |