系统相关
首页 > 系统相关> > k8s基础之五 DaemonSet守护进程集

k8s基础之五 DaemonSet守护进程集

作者:互联网

DaemonSet:守护进程集,缩写为ds,在所有节点或者是匹配的节点上都部署一个pod

运行集群存储的daemon,比如ceph,或者glusterd,
节点的CNI网络插件,calico
节点日志的收集:fluentd或者是filebeat
节点的健康:node exporter
服务暴露:ingress nginx

 

创建一个daemonSet

首先daemonset和deployment差别不大,daemonset和deployment的区别就是类型不一样,然后多了一个update字段

apiVersion: apps/v1
kind: DaemonSet
metadata:
  annotations:
    deprecated.daemonset.template.generation: "2"
  creationTimestamp: "2021-12-06T15:21:02Z"
  generation: 2
  labels:
    app: nginx
  name: nginx
  namespace: default
spec:
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:1.15.2
        imagePullPolicy: IfNotPresent
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      nodeSelector:
        ds: "True"
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 1
    type: RollingUpdate
status:
  currentNumberScheduled: 2
  desiredNumberScheduled: 2
  numberAvailable: 2
  numberMisscheduled: 0
  numberReady: 2
  observedGeneration: 2
  updatedNumberScheduled: 2

 

DaemonSet更新和回滚

kubectl set image ds nginx nginx=1.15.3 --record
# 吧标签ds = nginx的容器镜像更新为1.15.3

#更新建议使用ondelete不建议使用RollingUpdateRollingUpdate
#因为使用RollingUpdateRollingUpdate的话影响范围很大,因此使用ondelete更新完手动删除一个不太重要的节点,如果有问题影响的只是哪一个比较不重要的节点

 

标签:1.15,ds,nginx,DaemonSet,之五,k8s,节点,daemonset
来源: https://www.cnblogs.com/RRecal/p/15698775.html