当前位置: 首页 > news >正文

平顶山做网站的公司网站推广内容

平顶山做网站的公司,网站推广内容,深圳一建公司,郑州做网站找哪家DaemonSet控制器:概念、原理解读 DaemonSet概述DaemonSet工作原理:如何管理PodDaemonset典型的应用场景DaemonSet 与 Deployment 的区别DaemonSet资源清单文件编写技巧 DaemonSet使用案例:部署日志收集组件fluentdDaemonset管理pod&#xff1…

DaemonSet控制器:概念、原理解读

  • DaemonSet概述
    • DaemonSet工作原理:如何管理Pod
    • Daemonset典型的应用场景
    • DaemonSet 与 Deployment 的区别
    • DaemonSet资源清单文件编写技巧
  • DaemonSet使用案例:部署日志收集组件fluentd
  • Daemonset管理pod:滚动更新
    • DaemonSet实现pod的滚动更新
    • 更新镜像版本,可以按照如下方法:

DaemonSet概述

DaemonSet控制器能够确保k8s集群所有的节点都运行一个相同的pod副本,当向k8s集群中增加node节点时,这个node节点也会自动创建一个pod副本,当node节点从集群移除,这些pod也会自动删除;删除Daemonset也会删除它们创建的pod

DaemonSet工作原理:如何管理Pod

daemonset的控制器会监听kuberntes的daemonset对象、pod对象、node对象,这些被监听的对象之变动,就会触发syncLoop循环让kubernetes集群朝着daemonset对象描述的状态进行演进

Daemonset典型的应用场景

  • 在集群的每个节点上运行存储,比如:glusterd 或 ceph。
  • 在每个节点上运行日志收集组件,比如:flunentd 、 logstash、filebeat等。
  • 在每个节点上运行监控组件,比如:Prometheus、 Node Exporter 、collectd等。

DaemonSet 与 Deployment 的区别

  • Deployment 部署的副本 Pod 会分布在各个 Node 上,每个 Node 都可能运行好几个副本。
  • DaemonSet 的不同之处在于:每个 Node 上最多只能运行一个副本。

DaemonSet资源清单文件编写技巧

查看定义Daemonset资源需要的字段有哪些

kubectl explain ds
KIND:     DaemonSet
VERSION:  apps/v1DESCRIPTION:DaemonSet represents the configuration of a daemon set.FIELDS:apiVersion	<string> #当前资源使用的api版本,跟VERSION:  apps/v1保持一致kind	<string>  #资源类型,跟KIND:  DaemonSet保持一致metadata	<Object> #元数据,定义DaemonSet名字的spec	<Object>    #定义容器的status	<Object>  #状态信息,不能改

查看DaemonSet的spec字段如何定义

kubectl explain ds.spec
KIND:     DaemonSet
VERSION:  apps/v1
RESOURCE: spec <Object>
DESCRIPTION:The desired behavior of this daemon set. More info:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusDaemonSetSpec is the specification of a daemon set.
FIELDS:minReadySeconds	<integer>   #当新的pod启动几秒种后,再kill掉旧的pod。revisionHistoryLimit	<integer> #历史版本selector	<Object> -required-  #用于匹配pod的标签选择器template	<Object> -required- #定义Pod的模板,基于这个模板定义的所有pod是一样的updateStrategy	<Object> #daemonset的升级策略

查看DaemonSet的spec.template字段如何定义
对于template而言,其内部定义的就是pod,pod模板是一个独立的对象

kubectl explain ds.spec.template
KIND:     DaemonSet
VERSION:  apps/v1
RESOURCE: template <Object>
FIELDS:metadata	<Object>spec<Object>

DaemonSet使用案例:部署日志收集组件fluentd

把fluentd-2-5-1.tar.gz上传到k8smaster和k8snode上

ctr -n=k8s.io images import fluentd_2_5_1.tar.gz
cat daemonset.yaml 
apiVersion: apps/v1  #DaemonSet使用的api版本
kind: DaemonSet     # 资源类型
metadata:name: fluentd-elasticsearch   #资源的名字namespace: kube-system      #资源所在的名称空间labels:k8s-app: fluentd-logging    #资源具有的标签
spec:selector:         #标签选择器matchLabels:name: fluentd-elasticsearchtemplate:metadata:labels:  #基于这回模板定义的pod具有的标签name: fluentd-elasticsearchspec:tolerations:   #定义容忍度- key: node-role.kubernetes.io/mastereffect: NoSchedulecontainers:    #定义容器- name: fluentd-elasticsearchimage: k8s/fluentd:v2.5.1resources:  #资源配额limits:memory: 200Mirequests:cpu: 100mmemory: 200MivolumeMounts: - name: varlogmountPath: /var/log   #把本地/var/log目录挂载到容器- name: varlibdockercontainersmountPath: /var/lib/docker/containers  
#把/var/lib/docker/containers/挂载到容器里readOnly: true  #挂载目录是只读权限terminationGracePeriodSeconds: 30  #优雅的关闭服务volumes:- name: varloghostPath:path: /var/log  #基于本地目录创建一个卷- name: varlibdockercontainershostPath:path: /var/lib/docker/containers  #基于本地目录创建一个卷
kubectl apply -f daemonset.yaml 
kubectl get ds -n kube-system
NAME               DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE 
fluentd-elasticsearch   3          3          3           3          
kubectl get pods -n kube-system -o wide

在这里插入图片描述

通过上面可以看到在k8s的三个节点均创建了fluentd这个pod
pod的名字是由控制器的名字-随机数组成的

Daemonset管理pod:滚动更新

DaemonSet实现pod的滚动更新

查看daemonset的滚动更新策略

kubectl explain ds.spec.updateStrategy
KIND:     DaemonSet
VERSION:  apps/v1
RESOURCE: updateStrategy <Object>
DESCRIPTION:An update strategy to replace existing DaemonSet pods with new pods.DaemonSetUpdateStrategy is a struct used to control the update strategy fora DaemonSet.
FIELDS:rollingUpdate	<Object>Rolling update config params. Present only if type = "RollingUpdate".type	<string>Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default isRollingUpdate.

查看rollingUpdate支持的更新策略

kubectl explain ds.spec.updateStrategy.rollingUpdate
KIND:     DaemonSet
VERSION:  apps/v1
RESOURCE: rollingUpdate <Object>
DESCRIPTION:Rolling update config params. Present only if type = "RollingUpdate".Spec to control the desired behavior of daemon set rolling update.FIELDS:maxUnavailable	<string>

上面表示rollingUpdate更新策略只支持maxUnavailabe,先删除在更新;因为我们不支持一个节点运行两个pod,因此需要先删除一个,在更新一个。

更新镜像版本,可以按照如下方法:

这个镜像启动pod会有问题,主要是演示daemonset如何在命令行更新pod

kubectl set image daemonsets fluentd-elasticsearch=ikubernetes/filebeat:5.6.6-alpine -n kube-system
kubectl set image daemonsets fluentd-elasticsearch fluentd-elasticsearch=ikubernetes/filebeat:5.6.6-alpine -n kube-system
http://www.hkea.cn/news/356919/

相关文章:

  • 不断改进网站建设公司百度官网优化
  • 万户网站宁波网站制作优化服务
  • 潍坊快速网站排名网站是怎么做出来的
  • 聚美优品的pc网站建设注册网址
  • 陕西省住房与城乡建设厅网站免费b站推广软件
  • 淮南市住房与城乡建设部网站网店买卖有哪些平台
  • 网页qq表情佛山百度快速排名优化
  • 网站建设方案论文1500社会新闻最新消息
  • 网站组建 需求分析市场监督管理局职责
  • 云课堂哪个网站做的好厦门关键词优化seo
  • 中企动力沈阳分公司seo免费诊断电话
  • 网站vps被黑湖人最新排名最新排名
  • 如何夸奖客户网站做的好seo课程心得体会
  • 有哪些做电子商务的网站时空seo助手
  • 临沂百度网站电脑培训机构哪个好
  • 无锡专业做网站的公司怎样把自己的产品放到网上销售
  • 大学网站建设管理办法推广技巧
  • 长春做网站公司seo关键词排名优化软件怎么选
  • 网站开发未按合同约定工期完工seo关键词排名怎么提升
  • 创可贴app海报制作网站百度seo优化方法
  • 龙岗品牌网站建设2024年新闻摘抄
  • 南阳住房和城乡建设厅网站招聘网站排名
  • 如何做网站活动封面建站的公司
  • 温州网站建设培训营销推广方案包括哪些内容
  • 厦门 建网站商业软文案例
  • wordpress读者墙站长之家seo工具包
  • 网站建设哪家好灵活苏州久远网络北京搜索引擎关键词优化
  • 网站优化怎么做 有什么技巧东莞seo建站
  • 什么网站可以做游戏机疫情最新数据消息
  • 企业网站开发报价单巩义网络推广