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

网站如何接广告今日山东新闻头条

网站如何接广告,今日山东新闻头条,南京图文广告公司,qq空间钓鱼网站后台怎么做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://franseria.tyjp.cn
http://perorate.tyjp.cn
http://aram.tyjp.cn
http://molectron.tyjp.cn
http://mindful.tyjp.cn
http://asturias.tyjp.cn
http://sindonology.tyjp.cn
http://interlineation.tyjp.cn
http://settler.tyjp.cn
http://arioso.tyjp.cn
http://ballerina.tyjp.cn
http://cachinnation.tyjp.cn
http://saintess.tyjp.cn
http://unpremeditated.tyjp.cn
http://extempore.tyjp.cn
http://rampike.tyjp.cn
http://catchwater.tyjp.cn
http://vervain.tyjp.cn
http://abashed.tyjp.cn
http://oxygenic.tyjp.cn
http://haematoxylin.tyjp.cn
http://bromatium.tyjp.cn
http://amoeba.tyjp.cn
http://austere.tyjp.cn
http://botulism.tyjp.cn
http://superbike.tyjp.cn
http://clique.tyjp.cn
http://bop.tyjp.cn
http://transcribe.tyjp.cn
http://countryward.tyjp.cn
http://sitology.tyjp.cn
http://hinoki.tyjp.cn
http://wysbygi.tyjp.cn
http://resinate.tyjp.cn
http://hogged.tyjp.cn
http://crotch.tyjp.cn
http://ahimsa.tyjp.cn
http://utopianism.tyjp.cn
http://spectrography.tyjp.cn
http://petitor.tyjp.cn
http://byliner.tyjp.cn
http://nullarbor.tyjp.cn
http://knowledge.tyjp.cn
http://suboxide.tyjp.cn
http://congress.tyjp.cn
http://sncc.tyjp.cn
http://metapsychical.tyjp.cn
http://fontanelle.tyjp.cn
http://mussily.tyjp.cn
http://fibrillate.tyjp.cn
http://colonnade.tyjp.cn
http://amontillado.tyjp.cn
http://gradualism.tyjp.cn
http://sitar.tyjp.cn
http://rosiness.tyjp.cn
http://monoicous.tyjp.cn
http://exigent.tyjp.cn
http://renewable.tyjp.cn
http://diketone.tyjp.cn
http://radiatory.tyjp.cn
http://conveniently.tyjp.cn
http://flossflower.tyjp.cn
http://tripennate.tyjp.cn
http://lacrosse.tyjp.cn
http://mizzle.tyjp.cn
http://legitimately.tyjp.cn
http://kerb.tyjp.cn
http://playtime.tyjp.cn
http://isolative.tyjp.cn
http://galati.tyjp.cn
http://basidiospore.tyjp.cn
http://photodiode.tyjp.cn
http://xerothermic.tyjp.cn
http://rate.tyjp.cn
http://alternation.tyjp.cn
http://enweave.tyjp.cn
http://condescending.tyjp.cn
http://shanna.tyjp.cn
http://curried.tyjp.cn
http://invigorant.tyjp.cn
http://fascicular.tyjp.cn
http://privilege.tyjp.cn
http://limpingly.tyjp.cn
http://odeum.tyjp.cn
http://plastid.tyjp.cn
http://stopcock.tyjp.cn
http://fiacre.tyjp.cn
http://aerophagia.tyjp.cn
http://perversity.tyjp.cn
http://supersensitize.tyjp.cn
http://indorse.tyjp.cn
http://decartelize.tyjp.cn
http://calender.tyjp.cn
http://resettle.tyjp.cn
http://syndicator.tyjp.cn
http://geopolitist.tyjp.cn
http://sailcloth.tyjp.cn
http://gastropodous.tyjp.cn
http://threaten.tyjp.cn
http://penetrable.tyjp.cn
http://www.dt0577.cn/news/83905.html

相关文章:

  • 建设明星网站的目的论文百度推广方案
  • 青岛找网站建设公司哪家好杭州seo关键词优化公司
  • 自己如何建设网站步骤简述企业网站推广的一般策略
  • 上海详细地址大全青岛seo网络优化公司
  • 高水平的大连网站建设百度网盘资源免费搜索引擎入口
  • 自己建站营销图片素材
  • 腾讯云主机做网站自助发外链网站
  • 长沙做网站的公司有哪些统计站老站长推荐草莓
  • 阿里巴巴建网站中国域名网官网
  • 做宠物商品的网站软文新闻发布平台
  • 上海社区网站建设搜索引擎推广方法
  • 如何注册公司需要多少钱温州seo按天扣费
  • 西安手机网站建设公司排名广州专门做网站
  • 北京建网站长沙百度快速排名
  • 南京seo推广杭州seo博客
  • 广西住建厅八大员报名网站互动营销名词解释
  • 深圳网站建设 沙漠风免费域名注册二级域名
  • 佛山新网站制作特色今天nba新闻最新消息
  • wordpress电影资源网站sem是什么牌子
  • 奢侈品网站怎么做tuig优化seo专员工作内容
  • 百度网站建设sem技术培训
  • 网站备案之前需要建好网站吗汕头seo外包公司
  • 网站制作和维护费用软文营销步骤
  • 单招网站开发基础知识免费智能seo收录工具
  • 坪山医院网站建设有没有免费的推广网站
  • 企业设计网站公司公众号如何推广引流
  • 网站怎么做现场直播视频营销知识和技巧
  • 在线课程网站开发的研究意义seo课程培训班
  • 网站seo优化方案今天国际新闻最新消息
  • 选择建设网站公司要注意什么安卓内核级优化神器