DaemonSet 详解

版本

详解

kind: ReplicaSet
apiVersion: apps/v1

metadata: (OjbectMeta)
  annotations: (object) 注释是一个非结构化的键值映射,与资源一起存储,可以由外部工具设置来存储和检索任意元数据。它们不可查询,在修改对象时应保留
  clusterName: 对象所属群集的名称。这用于区分不同集群中具有相同名称和命名空间的资源。此字段现在没有设置到任何位置,如果在create或update请求中设置了此字段,apiserver将忽略它
  creationTimestamp: 不需要设置此值,服务端自动生成
  deletionGracePeriodSeconds: 优雅删除时间,只有在deletionTimestamp:生效的时候才有效,Read-Only
  deletionTimestamp: 服务端设置,客户端不能设置
  finalizers: (string array) 从注册表中删除对象之前必须为空。每个条目都是负责组件的标识符,该组件将从列表中删除条目。如果对象的deletitiontimestamp为非nil,则只能删除此列表中的条目。
  generation:
  labels: 用于副本控制器及服务的匹配标签
  managedFields: 
  name: 
  namespace: 
  ownerReferences: 
  resourceVersion: 
  selfLink: 
  uid: 
spec: (DaemonSetSpec)
  minReadySeconds: integer
  revisionHistoryLimit: integer
  selector: (LabelSelector)
  template: (1-PodTemplateSpec)
    metadata: (ObjectMeta)
      annotations:
      clusterName: 
      creationTimestamp: 不需要设置此值,服务端自动生成
      deletionGracePeriodSeconds: 优雅删除时间,只有在deletionTimestamp:生效的时候才有效,Read-Only
      deletionTimestamp: 服务端设置,客户端不能设置
      finalizers: 
      generation:
      labels: 用于副本控制器及服务的匹配标签
      managedFields: 
      name: 
      namespace: 
      ownerReferences: 
      resourceVersion: 
      selfLink: 
      uid: 
    spec: (2-PodSpec)
      activeDeadlineSeconds: integer 可选持续时间(以秒为单位),在系统尝试标记失败并杀死相关容器之前,pod可能在相对于StartTime的节点上处于活动状态。值必须为正整数
      affinity: (Affinity) 亲和性,Pod的调度约束
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          -
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key:
                operator:
                values:
                - String
              matchFields:
              - key:
                operator:
                values:
                - String
        podAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
              - matchExpressions:
                  key:
                  operator:
                  values:
                  - String
                matchLabels:
              namespaces:
              topologyKey:
            weight: 1-100的数值
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key:
                operator:
                values:
                - String
              matchLabels:
            namespaces:
            - String
            topologyKey:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key:
                  operator:
                  values:
                  - String
                matchLabels:
              namespaces:
              - String
              topologyKey:
            weight: 1-100的数值
          requiredDuringSchedulingIgnoredDuringExecution:
          - 
      automountServiceAccountToken: boolean  AutomountServiceAccountToken指示是否应自动装入服务帐户令牌
      containers: (3-Container array) 属于当前pod的容器,至少1个,
      - args:
        - String
        command:
        - String
        env:
        - name:  必须是: C_IDENTIFIER
          value:  可以通过$(VAR_NAME)引用env变量
          valueFrom: value来源,如果value不是空,此项不可用
            configMapKeyRef:
              key:
              name:
              optional:
            fieldRef:
              apiVersion:
              fieldPath:
            resourceFieldRef:
              containerName:String 可选项,但是对于volumes必须配置
              divisor: 指定暴露的资源的格式,默认为:1
              resource: 
            secretKeyRef: 在pod的命名空间中选择一个密钥
              key:
              name:
              optional:
        image:
        imagePullPolicy: 可选项为: Always, Never, IfNotPresent;如果latest tag指定,默认为:Always,否则为IfNotPresent
        lifecycle: 
          postStart:
            exec: 
            httpGet: 
            tcpSocket: 
          preStop: 
            exec: 
            httpGet: 
            tcpSocket: 
        livenessProbe: 
          exec:
            command: 
            - String 容器中命令行可以执行的命令
          failureThreshold: 认为probe失败的最少次数,默认:3,最小值为:1
          httpGet: 
            host: 连接的主机名,默认为:pod的ip,可以在httpHeaders中设置:Host代替
            httpHeaders: 用户自定义header,允许重复
              name:
              value: 
            path: 访问http server的路径
            port: 访问容器的端口号或者名字,
            scheme: 默认值为:HTTP
          initialDelaySeconds:容器启动到livenness probes 初始化完成的时间
          periodSeconds: 多长时间执行一次probe,默认:10s,最小:1s
          successThreshold: 探测器在失败后被视为成功的最小连续成功次数。默认为1。必须为1才能激活和启动。最小值为1
          tcpSocket:
            host: 可选,要连接的主机名,默认为:pod的ip
            port: 要在容器上访问的端口的编号或名称。数字必须在1到65535之间。名称必须是IANA_SVC_NAME名称
          timeoutSeconds: probe超时时间,默认值为:1s,最小值为:1s
        name: DNS_LABEL格式的名字
        ports: 容器暴露的端口 
        - containerPort: pod的IP地址对应暴露的端口号  0 < x < 65536
          hostIP: 要将外部端口绑定到的主机IP
          hostPort: 主机暴露的端口号, 0 < x < 65536,如果指定HostNetwork,必须和containerPort一样
          name:  IANA_SVC_NAME格式,唯一
          protocol:  UDP, TCP, or SCTP. 默认为: "TCP"
        readinessProbe:
          exec:
            command:
            - String 容器中命令行可以执行的命令
          failureThreshold: 认为probe失败的最少次数,默认:3,最小值为:1
          httpGet: 
            host: 连接的主机名,默认为:pod的ip,可以在httpHeaders中设置:Host代替
            httpHeaders: 用户自定义header,允许重复
              name:
              value: 
            path: 访问http server的路径
            port: 访问容器的端口号或者名字,
            scheme: 默认值为:HTTP
          initialDelaySeconds:容器启动到livenness probes 初始化完成的时间
          periodSeconds: 多长时间执行一次probe,默认:10s,最小:1s
          successThreshold: 探测器在失败后被视为成功的最小连续成功次数。默认为1。必须为1才能激活和启动。最小值为1
          tcpSocket:
            host: 可选,要连接的主机名,默认为:pod的ip
            port: 要在容器上访问的端口的编号或名称。数字必须在1到65535之间。名称必须是IANA_SVC_NAME名称
          timeoutSeconds: probe超时时间,默认值为:1s,最小值为:1s         
        resources:
          limits: Limits描述允许的最大计算资源量
          requests: 请求描述所需的最小计算资源量
        securityContext:
          allowPrivilegeEscalation: boolean
          capabilities: 运行容器时添加/删除的功能。默认为容器运行时授予的默认功能集
            add:
            - String
            drop:
            - String
          privileged: 默认为:false
          procMount: 默认为:DefaultProcMount ;
          readOnlyRootFilesystem: 是否为只读的root文件系统,默认:false
          runAsGroup: 运行容器entrypoint的用户的gid
          runAsNonRoot: boolean,true: 非root运行; SecurityContext PodSecurityContext都设置,SecurityContext优先
          runAsUser:  运行容器entrypoint的用户的uid
          seLinuxOptions: 
            level:
            role:
            type:
            user:
          windowsOptions: 
        startupProbe:
          exec:
            command:
            - String 容器中命令行可以执行的命令
          failureThreshold: 认为probe失败的最少次数,默认:3,最小值为:1
          httpGet: 
            host: 连接的主机名,默认为:pod的ip,可以在httpHeaders中设置:Host代替
            httpHeaders: 用户自定义header,允许重复
              name:
              value: 
            path: 访问http server的路径
            port: 访问容器的端口号或者名字,
            scheme: 默认值为:HTTP
          initialDelaySeconds:容器启动到livenness probes 初始化完成的时间
          periodSeconds: 多长时间执行一次probe,默认:10s,最小:1s
          successThreshold: 探测器在失败后被视为成功的最小连续成功次数。默认为1。必须为1才能激活和启动。最小值为1
          tcpSocket:
            host: 可选,要连接的主机名,默认为:pod的ip
            port: 要在容器上访问的端口的编号或名称。数字必须在1到65535之间。名称必须是IANA_SVC_NAME名称
          timeoutSeconds: probe超时时间,默认值为:1s,最小值为:1s
        stdin: 是否为stdin分配buffer,默认false
        stdinOnce: 
        terminationMessagePath:
        terminationMessagePolicy:
        tty: 是否为容器分配一个tty,默认:false
        volumeDevices: 容器使用块设备
        - devicePath: 块设备映射到容器的路径
          name: 与pod中pvc的名字必须匹配
        volumeMounts: 挂载到容器的文件系统
        - mountPath: 容器内路径
          mountPropagation:
          name: volume名字
          readOnly: 是否以只读方式挂载,如果为:true,只读,默认为:false
          subPath: 应从中装入容器卷的卷中的路径
          subPathExpr: 类似subPath,支持 $(VAR_NAME)扩展
        workingDir: 容器的工作目录
      dnsConfig: (3-PodDNSConfig)
        nameservers: dns ip列表
        - String 
        options: dns解析选项
        - name:
          value:
        searches: 用于主机名查找的DNS搜索域列表
        - 
      dnsPolicy: (3-string) 有效值为 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None',默认:ClusterFirst
      enableServiceLinks: service注射到pod的环境变量,默认为:true
      ephemeralContainers: (3-EphemeralContainer array)临时容器列表
      - args:
        - String
        command:
        - String
        env:
        - name
          value:
          valueFrom:
            configMapKeyRef:
            fieldRef:
            resourceFieldRef:
            secretKeyRef:
        envFrom:
        - configMapRef:

          prefix:
          secretRef:

        image:
        imagePullPolicy:
        lifecycle:

        livenessProbe:

        name:
        ports:

        readinessProbe:

        resources:

        securityContext:

        startupProbe:

        stdin:
        stdinOnce:
        targetContainerName:
        terminationMessagePath:
        terminationMessagePolicy:
        tty:
        volumeDevices:
        - 
        volumeMounts:
        - 
        workingDir:
      hostAliases: (HostAlias array) 注射到pod的hosts中的ip 主机名信息,对非hostNetwork Pods生效
      - hostnames:
        ip: 
      hostIPC: 使用主机的ipc命名空间,默认为:false
      hostNetwork: 是否使用主机网络,默认为:false
      hostPID: 使用主机的pid名称空间,默认为:false
      hostname: 指定pod的主机名,如果不设置,生成默认值
      imagePullSecrets: (LocalObjectReference array)可选,在同一个namespace中的secret
      - name: 
      initContainers: (Container array)
      - args:
        - String
        command:
        - String
        env:
        - name:  必须是: C_IDENTIFIER
          value:  可以通过$(VAR_NAME)引用env变量
          valueFrom: value来源,如果value不是空,此项不可用
            configMapKeyRef:
              key:
              name:
              optional:
            fieldRef:
              apiVersion:
              fieldPath:
            resourceFieldRef:
              containerName:String 可选项,但是对于volumes必须配置
              divisor: 指定暴露的资源的格式,默认为:1
              resource: 
            secretKeyRef: 在pod的命名空间中选择一个密钥
              key:
              name:
              optional:
        image:
        imagePullPolicy: 可选项为: Always, Never, IfNotPresent;如果latest tag指定,默认为:Always,否则为IfNotPresent
        lifecycle: 
          postStart:
            exec: 
            httpGet: 
            tcpSocket: 
          preStop: 
            exec: 
            httpGet: 
            tcpSocket: 
        livenessProbe: 
          exec:
            command: 
            - String 容器中命令行可以执行的命令
          failureThreshold: 认为probe失败的最少次数,默认:3,最小值为:1
          httpGet: 
            host: 连接的主机名,默认为:pod的ip,可以在httpHeaders中设置:Host代替
            httpHeaders: 用户自定义header,允许重复
              name:
              value: 
            path: 访问http server的路径
            port: 访问容器的端口号或者名字,
            scheme: 默认值为:HTTP
          initialDelaySeconds:容器启动到livenness probes 初始化完成的时间
          periodSeconds: 多长时间执行一次probe,默认:10s,最小:1s
          successThreshold: 探测器在失败后被视为成功的最小连续成功次数。默认为1。必须为1才能激活和启动。最小值为1
          tcpSocket:
            host: 可选,要连接的主机名,默认为:pod的ip
            port: 要在容器上访问的端口的编号或名称。数字必须在1到65535之间。名称必须是IANA_SVC_NAME名称
          timeoutSeconds: probe超时时间,默认值为:1s,最小值为:1s
        name: DNS_LABEL格式的名字
        ports: 容器暴露的端口 
        - containerPort: pod的IP地址对应暴露的端口号  0 < x < 65536
          hostIP: 要将外部端口绑定到的主机IP
          hostPort: 主机暴露的端口号, 0 < x < 65536,如果指定HostNetwork,必须和containerPort一样
          name:  IANA_SVC_NAME格式,唯一
          protocol:  UDP, TCP, or SCTP. 默认为: "TCP"
        readinessProbe:
           exec:
            command:
            - String 容器中命令行可以执行的命令
          failureThreshold: 认为probe失败的最少次数,默认:3,最小值为:1
          httpGet: 
            host: 连接的主机名,默认为:pod的ip,可以在httpHeaders中设置:Host代替
            httpHeaders: 用户自定义header,允许重复
              name:
              value: 
            path: 访问http server的路径
            port: 访问容器的端口号或者名字,
            scheme: 默认值为:HTTP
          initialDelaySeconds:容器启动到livenness probes 初始化完成的时间
          periodSeconds: 多长时间执行一次probe,默认:10s,最小:1s
          successThreshold: 探测器在失败后被视为成功的最小连续成功次数。默认为1。必须为1才能激活和启动。最小值为1
          tcpSocket:
            host: 可选,要连接的主机名,默认为:pod的ip
            port: 要在容器上访问的端口的编号或名称。数字必须在1到65535之间。名称必须是IANA_SVC_NAME名称
          timeoutSeconds: probe超时时间,默认值为:1s,最小值为:1s         
        resources:
          limits: Limits描述允许的最大计算资源量
          requests: 请求描述所需的最小计算资源量
        securityContext:
          allowPrivilegeEscalation: boolean
          capabilities: 运行容器时添加/删除的功能。默认为容器运行时授予的默认功能集
            add:
            - String
            drop:
            - String
          privileged: 默认为:false
          procMount: 默认为:DefaultProcMount ;
          readOnlyRootFilesystem: 是否为只读的root文件系统,默认:false
          runAsGroup: 运行容器entrypoint的用户的gid
          runAsNonRoot: boolean,true: 非root运行; SecurityContext PodSecurityContext都设置,SecurityContext优先
          runAsUser:  运行容器entrypoint的用户的uid
          seLinuxOptions: 
            level:
            role:
            type:
            user:
          windowsOptions: 
        startupProbe:
          exec:
            command:
            - String 容器中命令行可以执行的命令
          failureThreshold: 认为probe失败的最少次数,默认:3,最小值为:1
          httpGet: 
            host: 连接的主机名,默认为:pod的ip,可以在httpHeaders中设置:Host代替
            httpHeaders: 用户自定义header,允许重复
              name:
              value: 
            path: 访问http server的路径
            port: 访问容器的端口号或者名字,
            scheme: 默认值为:HTTP
          initialDelaySeconds:容器启动到livenness probes 初始化完成的时间
          periodSeconds: 多长时间执行一次probe,默认:10s,最小:1s
          successThreshold: 探测器在失败后被视为成功的最小连续成功次数。默认为1。必须为1才能激活和启动。最小值为1
          tcpSocket:
            host: 可选,要连接的主机名,默认为:pod的ip
            port: 要在容器上访问的端口的编号或名称。数字必须在1到65535之间。名称必须是IANA_SVC_NAME名称
          timeoutSeconds: probe超时时间,默认值为:1s,最小值为:1s
        stdin: 是否为stdin分配buffer,默认false
        stdinOnce: 
        terminationMessagePath:
        terminationMessagePolicy:
        tty: 是否为容器分配一个tty,默认:false
        volumeDevices: 容器使用块设备
        - devicePath: 块设备映射到容器的路径
          name: 与pod中pvc的名字必须匹配
        volumeMounts: 挂载到容器的文件系统
        - mountPath: 容器内路径
          mountPropagation:
          name: volume名字
          readOnly: 是否以只读方式挂载,如果为:true,只读,默认为:false
          subPath: 应从中装入容器卷的卷中的路径
          subPathExpr: 类似subPath,支持 $(VAR_NAME)扩展
        workingDir: 容器的工作目录
      nodeName: 调度到指定的node
      nodeSelector: 调度到打了指定label的node
      overhead: 云行pod相关的资源开销,admission controller自动填充
      preemptionPolicy: 是用于抢占具有较低优先级的pod的策略;默认值: PreemptLowerPriority,有效值为: Never, PreemptLowerPriority
      priority: 值越大,优先级越高
      priorityClassName: 
      readinessGates: 如果指定,所有准备状态门都将评估pod准备状态
      - conditionType: 
      restartPolicy:  Always, OnFailure, Never. 默认值为: Always
      runtimeClassName: 
      schedulerName:
      securityContext:
        allowPrivilegeEscalation: boolean
        capabilities: 运行容器时添加/删除的功能。默认为容器运行时授予的默认功能集
          add:
          - String
          drop:
          - String
        privileged: 默认为:false
        procMount: 默认为:DefaultProcMount ;
        readOnlyRootFilesystem: 是否为只读的root文件系统,默认:false
        runAsGroup: 运行容器entrypoint的用户的gid
        runAsNonRoot: boolean,true: 非root运行; SecurityContext PodSecurityContext都设置,SecurityContext优先
        runAsUser:  运行容器entrypoint的用户的uid
        seLinuxOptions: 
          level:
          role:
          type:
          user:
        windowsOptions: 
      serviceAccount:
      serviceAccountName:
      shareProcessNamespace:
      subdomain:
      terminationGracePeriodSeconds:
      tolerations: 如果指定,则为pod的耐受性
      - effect:
        key:
        operator:
        tolerationSeconds:
        value:
      topologySpreadConstraints: 描述了一组pod应该如何跨拓扑学域分布。调度器将以一种遵守约束的方式调度pod。alpha级别的,只有启用EvenPodsSpread特性的集群才用它。AND
      - labelSelector:
          matchExpressions:
          - key:
            operator: 有效的操作符为: In, NotIn, Exists and DoesNotExist.
            values:
            - String
          matchLabels
        maxSkew:
        topologyKey:
        whenUnsatisfiable:
      volumes:
      - awsElasticBlockStore:
        azureDisk:
        azureFile:
        cephfs: 对象为:CephFSVolumeSource  
          monitors: ceph的monitors
          path: 默认为:/ 可选
          readOnly: true-只读,默认为:false 可读写 可选
          secretFile:  可选
          secretRef: 用户的认证秘钥,默认为empty
            name: 参照名
          user: rados用户名,默认为:admin
        cinder:
          fsType: "ext4", "xfs", "ntfs" ,默认为:"ext4"
          readOnly: 默认:false
          secretRef:  指向包含用于连接到OpenStack的参数的机密对象
            name: String
          volumeID: cinder中卷的标识id
        configMap:
          defaultMode: 创建文件默认的权限位,默认:0644
          items:
          - key:
            mode: 
            path: 
          name: 参照名
          optional: boolean,指定configMap中的keys是否必须定义;

        csi:
          driver:
          fsType: 
          nodePublishSecretRef: 传递给csi驱动的包含敏感信息的secret对象,
            name: 参照名
          readOnly: 默认:false
          volumeAttributes: 传递给csi的参数
        downwardAPI:
        emptyDir:
        fc:
        flexVolume:
        flocker:
        gcePersistentDisk:
        gitRepo: DEPRECATED
        glusterfs:
        hostPath: HostPath表示主机上直接暴露给容器的预先存在的文件或目录
          path: 主机目录
          type: 默认为: ""
        iscsi:
          chapAuthDiscovery:
          chapAuthSession: 
          fsType:  "ext4", "xfs", "ntfs",默认为:ext4
          initiatorName: 
          iqn: 
          iscsiInterface: 
          lun: 
          portals: 
          readOnly: 
          secretRef: 
            name: 参照名
          targetPortal
        name:  DNS_LABEL 唯一
        nfs:
        persistentVolumeClaim:
        photonPersistentDisk:
        portworxVolume:
        projected:
        quobyte:
        rbd:
        scaleIO:
        secret:
        storageos:
        vsphereVolume: VsphereVirtualDiskVolumeSource 
          fsType: "ext4", "xfs", "ntfs" ,默认为:"ext4"
          storagePolicyID: Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName
          storagePolicyName: Storage Policy Based Management (SPBM) profile name
          volumePath: Path that identifies vSphere volume vmdk
  updateStrategy: (DaemonSetUpdateStrategy)









status: (DaemonSetStatus)