pod容忍(toleration)
污点就是拒绝,容忍就是忽略,Node通过污点拒绝pod调度上去,Pod通过容忍忽略拒绝
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
namespace: test
spec:
replicas: 1
selector:
matchLabels:
environment: stg
template:
metadata:
labels:
environment: stg
spec:
containers:
- name: nginx-container
image: nginx:latest
imagePullPolicy: IfNotPresent
ports:
- name: nginx-port
containerPort: 80
protocol: TCP
lifecycle:
postStart:
exec:
command: ["/bin/sh","-c","echo jiayouba!!!!!>/usr/share/nginx/html/index.html"]
affinity: #亲和性设置
nodeAffinity: #设置node亲和性
preferredDuringSchedulingIgnoredDuringExecution: #软限制
- weight: 1
preference:
matchExpressions:
- key: env
operator: In
values: ["aaaa","bbbb"]
tolerations:
- key: tag
operator: "Equal"
value: "ceshi"
effect: NoExecute
本文来自博客园,作者:弩哥++,转载请注明原文链接:https://www.cnblogs.com/bangbangzoutianya/p/16852021.html