|NO.Z.00146|——————————|CloudNative|——|KuberNetes&资源调度.V16|——|daemonset.v01|创建|
一、DaemonSet概述
### --- DaemonSet是什么?
~~~ DaemonSet:守护进程集,缩写为ds,在所有节点或者是匹配的节点上都部署一个Pod。
### --- DaemonSet应用场景
~~~ 运行集群存储的daemon,比如ceph或者glusterd
~~~ 节点的CNI网络插件,calico(在每个节点上充当路由器,去分发网络)
~~~ 节点日志的收集:fluentd或者是filebeat
~~~ 节点的监控:node exporter
~~~ 服务暴露:部署一个ingress nginx
二、创建DaemonSet
### --- 创建nginx-daemonset.yaml配置文件
~~~ 没有副本数的概念,
~~~ 灰度更新删除掉
[root@k8s-master01 ~]# vim nginx-ds.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: nginx
name: nginx
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
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
### --- 创建nginx-daemonset
~~~ # 创建nginx-daemonset.yaml
[root@k8s-master01 ~]# kubectl create -f nginx-ds.yaml
daemonset.apps/nginx created
~~~ # 查看创建的daemonset.pod
[root@k8s-master01 ~]# kubectl get node -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master01 Ready <none> 9d v1.20.0 192.168.1.11 <none> CentOS Linux 7 (Core) 4.19.12-1.el7.elrepo.x86_64 docker://19.3.15
k8s-master02 Ready <none> 9d v1.20.0 192.168.1.12 <none> CentOS Linux 7 (Core) 4.19.12-1.el7.elrepo.x86_64 docker://19.3.15
k8s-master03 Ready <none> 9d v1.20.0 192.168.1.13 <none> CentOS Linux 7 (Core) 4.19.12-1.el7.elrepo.x86_64 docker://19.3.15
k8s-node01 Ready <none> 9d v1.20.0 192.168.1.14 <none> CentOS Linux 7 (Core) 4.19.12-1.el7.elrepo.x86_64 docker://19.3.15
k8s-node02 Ready <none> 9d v1.20.0 192.168.1.15 <none> CentOS Linux 7 (Core) 4.19.12-1.el7.elrepo.x86_64 docker://19.3.15
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了