k8s控制器,daemonset
一、DaemonSet 是什么DaemonSet 守护进程集核心作用保证集群里 每一个节点 都运行 一个 Pod不需要写replicas节点数 Pod 数新增节点 →自动创建 Pod删除节点 →自动删除 Pod每个节点永远只跑一个二、典型应用场景节点监控node-exporterPrometheus 采集监控日志收集fluentd、filebeat网络 / 存储插件calico、ceph其他 agent各种监控代理、安全客户端三、完整标准 YAMLnode1,node2上运行vim k8s-ds.yamlapiVersion: apps/v1 kind: DaemonSet metadata: name: ds namespace: default labels: app: ds spec: selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.20.2 resources: limits: memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: - name: localtime mountPath: /etc/localtime terminationGracePeriodSeconds: 30 volumes: - name: localtime hostPath: path: /usr/share/zoneinfo/Asia/Shanghaikubectl apply -f k8s-ds.yamlmaster(容忍),node1,node2上运行vim k8s-ds-tole.yamlapiVersion: apps/v1 kind: DaemonSet metadata: name: ds namespace: default labels: app: ds spec: selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: tolerations: - key: node-role.kubernetes.io/control-plane #节点的污点是这个 → 必须匹配 operator: Exists # 存在即可不用写value effect: NoSchedule # 容忍“不调度”污点 containers: - name: nginx image: nginx:1.20.2 resources: limits: memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: - name: localtime mountPath: /etc/localtime terminationGracePeriodSeconds: 30 volumes: - name: localtime hostPath: path: /usr/share/zoneinfo/Asia/Shanghaikubectl apply -f k8s-ds-tole.yaml
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2447646.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!