51工具盒子

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

K8S 的 daemonSet控制器:

K8S 的 daemonSet控制器:

可以将每个节点都部署一个Pod,可以让每个节点有切只有一个。

参考案例:

cat 01-ds.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: baimei-ds
spec:
  selector:
    matchLabels:
      apps: v1
  template:
    metadata:
      labels:
        apps: v1
    spec:
      # nodeSelector:
      #   type: ssd
      #
      # affinity:
      #   nodeAffinity:
      #      requiredDuringSchedulingIgnoredDuringExecution:
      #        nodeSelectorTerms:
      #        - matchExpressions:
      #          - key: school
      #            values: 
      #            - baimei
      #            - yitiantain
      #            operator: In
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      containers:
      - name: web
        image: harbor.baimei.com/baimei-apps/apps:v1

运行

kubectl  get pods -o wide --show-labels

kubectl  get pods -o wide --show-labels

可以发现,每个节点都有一个 pod 在运行

赞(5)
未经允许不得转载:工具盒子 » K8S 的 daemonSet控制器: