zoukankan      html  css  js  c++  java
  • k8s Daemonset功能

    1. k8s-Daemonset功能

    • DaemonSet功能:

      • 在每一个Node上运行一个Pod
      • 新加入的Node也同样会自动运行一个Pod
    • 应用场景:网络插件(kube-proxy、calico)、其他Agent

    • 示图:
      image

    • 示例代码:

      [root@k8s-master deployment]# vim daemonset.yaml
      [root@k8s-master deployment]# cat daemonset.yaml
      apiVersion: apps/v1
      kind: DaemonSet
      metadata:
        name: filebeat
        namespace: kube-system
      spec:
        selector:
          matchLabels:
            name: filebeat
        template:
          metadata:
            labels:
              name: filebeat
          spec:
            containers:
            - name: log
              image: elastic/filebeat:7.3.2
      
      

    2. 案例

    • 编写配置

      [root@k8s-master deployment]# vim daemonset.yaml
      [root@k8s-master deployment]# cat daemonset.yaml
      apiVersion: apps/v1
      kind: DaemonSet
      metadata:
        name: filebeat
        namespace: kube-system
      spec:
        selector:
          matchLabels:
            name: filebeat
        template:
          metadata:
            labels:
              name: filebeat
          spec:
            containers:
            - name: log
              image: elastic/filebeat:7.3.2
      
    • 执行案例

      [root@k8s-master deployment]# kubectl apply -f daemonset.yaml 
      daemonset.apps/filebeat created
      
    • 查询服务

      [root@k8s-master deployment]# kubectl get pods -n kube-system 
      NAME                                       READY   STATUS    RESTARTS   AGE
      calico-kube-controllers-5dc87d545c-nscfb   1/1     Running   3          6d20h
      calico-node-j6rhw                          1/1     Running   3          6d20h
      calico-node-n7d6s                          1/1     Running   3          6d20h
      calico-node-x86s2                          1/1     Running   3          6d20h
      coredns-6d56c8448f-hkgnk                   1/1     Running   4          6d23h
      coredns-6d56c8448f-jfbjs                   1/1     Running   3          6d23h
      etcd-k8s-master                            1/1     Running   4          6d23h
      filebeat-7cz4r                             1/1     Running   0          3m25s
      filebeat-tdsm9                             1/1     Running   0          3m25s
      kube-apiserver-k8s-master                  1/1     Running   9          6d23h
      kube-controller-manager-k8s-master         1/1     Running   9          6d23h
      kube-proxy-fhgbd                           1/1     Running   3          6d22h
      kube-proxy-l7q4r                           1/1     Running   3          6d23h
      kube-proxy-qwpjp                           1/1     Running   3          6d22h
      kube-scheduler-k8s-master                  1/1     Running   10         6d23h
      
  • 相关阅读:
    用户场景故事
    我喜欢的输入法
    课堂练习-----查找水王
    《你的灯亮着吗》阅读笔记1
    补第二阶段冲刺站立会议6(原6月8日)
    补第二阶段冲刺站立会议5(原6月7日)
    补第二阶段冲刺站立会议4(原6月6日)
    补第二次冲刺站立会议3(原6月5日)
    补第二次冲刺站立会议2(原6月4日)
    补第二次阶段冲刺站立会议1(原6月3日)
  • 原文地址:https://www.cnblogs.com/scajy/p/15493180.html
Copyright © 2011-2022 走看看