51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

k8s 污点之 PreferNoSchedule的调度案例

PreferNoSchedule的调度案例

1.给worker232打污点

kubectl taint node worker232 school=baimei:PreferNoSchedule

kubectl describe nodes  | grep -i taints

2.编写资源清单并验证

cat 01-taint.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploy-taint
spec:
  replicas: 10
  selector:
    matchExpressions:
    - key: apps
      values: 
      - "v1"
      - "v2"
      operator: NotIn
  template:
    metadata:
      labels:
        school: baimei
    spec:
      # 如果测试效果不明显,可以使用nodeName来测试
      #nodeName: worker232
      containers:
      - name: v1
        image: harbor.baimei.com/baimei-apps/apps:v1

kubectl get pods -o wide

3.取消污点

kubectl taint node worker232 school-

kubectl describe nodes  | grep -i taints
赞(6)
未经允许不得转载:工具盒子 » k8s 污点之 PreferNoSchedule的调度案例