|NO.Z.00146|——————————|CloudNative|——|KuberNetes&資源排程.V16|-------------------------------------------------------|daemonset.v01|建立|
阿新 • • 發佈:2022-03-30
[CloudNative:KuberNetes&資源排程.V16] [Applications.KuberNetes] [|DevOps|k8s|資源排程|DaemonSet使用|DaemonSet更新和回滾|]
一、DaemonSet概述
### --- DaemonSet是什麼?
~~~ DaemonSet:守護程序集,縮寫為ds,在所有節點或者是匹配的節點上都部署一個Pod。
二、建立DaemonSet### --- DaemonSet應用場景 ~~~ 執行叢集儲存的daemon,比如ceph或者glusterd ~~~ 節點的CNI網路外掛,calico(在每個節點上充當路由器,去分發網路) ~~~ 節點日誌的收集:fluentd或者是filebeat ~~~ 節點的監控:node exporter ~~~ 服務暴露:部署一個ingress nginx
### --- 建立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
===============================END===============================
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
來自為知筆記(Wiz)