|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

 

 

posted on 2022-03-30 11:59  yanqi_vip  阅读(33)  评论(0)    收藏  举报

导航