CC00146.CloudKubernetes——|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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yanqi_vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值