apiVersion: v1 kind: Pod metadata: name: my-pod spec: nodeSelector: kubernetes.io/hostname: uat-xxxxx # 关键代码 containers: - name: my-container image: my-image yaml配置示例yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: replicas: 3 selector: matchLabels...
Job配置中的nodeSelector字段用于选择标签为kubernetes.io/hostname: cn-beijing.192.168.0.140的节点来...
name: node-affinity spec: containers: name: nginx image: nginx affinity: nodeAffinity: node亲和性 requiredDuringSchedulingIgnoredDuringExecution: 必须满足该模块的条件 nodeSelectorTerms: matchExpressions: key: kubernetes.io/hostname operator: In 以下条件在列表内,才可调度 values: 调度的节点必须是server3...
topologyKey:"kubernetes.io/hostname" podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - store topologyKey:"kubernetes.io/hostname" containers: - name: web-app image: nginx:1.16-alpine 亲和性 软亲和 示例: 1、先创建一...
PodFitsHost:如果Pod指定了nodeName,检查节点名称是否和nodeName匹配 PodFitsHostPort:节点上已经使用的port是否和Pod申请的port冲突 PodSelectorMatches:过滤和Pod指定的 label 不匹配的节点 NoDiskConflict:已经 mount 的 volume 和 Pod 指定的volume不冲突,除非他们都是只读 ...
kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node02,kubernetes.io/os=linux 添加label标签 运行kubectl get nodes以获取群集节点的名称。然后可以对指定节点添加标签。比如:k8s-node01的磁盘为SSD,那么添加disk-type=ssd;k8s-node02的CPU核数高,那么添加cpu-type=hight;如果为Web...
k8s-m3 Ready control-plane,master 20m v1.22.10 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-m3,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node-role.kubernetes.io/master=,node.kubernetes.io/exclude-from-externa...
- key: kubernetes.io/hostname operator: NotIn values: - node3.hde.h3c.com preferredDuringSchedulingIgnoredDuringExecution: # 软策略 - weight: 1 preference: matchExpressions: - key: com operator: In values: - liuli 1. 2. 3. 4. 5. ...
kBs-node-1kubernetes.io/hostname=kBs-node-1,zone=north Ready 上述命令行操作也可以通过修改资源定义文件的方式 , 并执行 kubectl replace -f xxx.yaml 命令来完成。 (2)然后,在 Pod 的定义中加上 nodeSelector 的设置,以 redis-master-controIler. yaml 为例: ...
kubernetes.io/hostname failure-domain.beta.kubernetes.io/zone failure-domain.beta.kubernetes.io/region beta.kubernetes.io/instance-type kubernetes.io/os kubernetes.io/arch 注意:当集群中不存在NodeSelector指定的Node,即使集群中还有其他可供使用的Node,这个Pod也不会被成功调度。