# 官方提供@yunTaoScripts DAEMONSET 🔥🔥

loading

# 创建DAEMONSET

快速创建daemonset

  • 创建deployment
  • 修改kind -> DaemonSet
  • 删除replicas、stratagy、status
  • kubectl apply -f ds-web.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  creationTimestamp: null
  labels:
    app: ds-web
  name: ds-web
spec:
  selector:
    matchLabels:
      app: ds-web
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: ds-web
    spec:
      terminationGracePeriodSeconds: 0
      containers:
      - image: nginx
        name: nginx
        imagePullPolicy: IfNotPresent
        resources: {}

# 指定Node节点

  • 如何不存在满足条件的node,就不会去创建pod。
apiVersion: apps/v1
kind: DaemonSet
metadata:
  creationTimestamp: null
  labels:
    app: ds-web1
  name: ds-web1
spec:
  selector:
    matchLabels:
      app: ds-web1
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: ds-web1
    spec:
      terminationGracePeriodSeconds: 0
      nodeSelector:    
        disktype: ssd
      containers:
      - image: nginx
        name: nginx
        imagePullPolicy: IfNotPresent
        resources: {}