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

软件介绍网站模板/千博企业网站管理系统

软件介绍网站模板,千博企业网站管理系统,网页开发外包,高端定制网站建设制作ReplicaSet 和 ReplicationController 是 Kubernetes 中用于管理应用程序副本的两种资源,它们有类似的功能,但 ReplicaSet 是 ReplicationController 的增强版本。 以下是它们的主要区别: 1. 功能的演进 ReplicationController 是 Kubernete…

ReplicaSetReplicationController 是 Kubernetes 中用于管理应用程序副本的两种资源,它们有类似的功能,但 ReplicaSetReplicationController 的增强版本。

以下是它们的主要区别:

1. 功能的演进

  • ReplicationController 是 Kubernetes 的早期版本中用来确保一定数量的 Pod 副本运行的控制器。

  • ReplicaSetReplicationController 的增强版本,引入了更多的功能和灵活性,逐步取代了 ReplicationController

2. 标签选择器

  • ReplicationController 只支持基于 等式匹配 的标签选择器。例如:

    selector:app: myapp
    
  • ReplicaSet 支持更复杂的 集合匹配,可以使用 innotin 等操作符。例如:

    selector:matchLabels:app: myappmatchExpressions:- key: environmentoperator: Invalues:- production- staging
    

3. 推荐使用

  • Kubernetes 更推荐使用 ReplicaSet,因为它功能更强大,尤其是支持高级标签选择器。

  • 不过,ReplicationController 仍然受支持,用于与旧版本的 Kubernetes 配置兼容。

4. 与 Deployment 的关系

  • ReplicaSet 通常与 Deployment 一起使用,Deployment 会管理 ReplicaSet,从而实现滚动更新等功能。

  • ReplicationController 已经逐渐被 DeploymentReplicaSet 取代,功能上相对较弱。

示例对比

ReplicationController 配置示例:

 

apiVersion: v1
kind: ReplicationController
metadata:name: myapp-rc
spec:replicas: 3selector:app: myapptemplate:metadata:labels:app: myappspec:containers:- name: myapp-containerimage: nginx
ReplicaSet 配置示例:

apiVersion: apps/v1
kind: ReplicaSet
metadata:name: myapp-rs
spec:replicas: 3selector:matchLabels:app: myappmatchExpressions:- key: environmentoperator: Invalues:- productiontemplate:metadata:labels:app: myappspec:containers:- name: myapp-containerimage: nginx

 

 

Scale

总结

  • 如果是新项目,直接使用 ReplicaSetDeployment,避免使用 ReplicationController

  • 如果你的需求更复杂(比如基于集合匹配的调度策略),ReplicaSet 是更好的选择。

练习

controlplane ~ ➜  kubectl get pods
No resources found in default namespace.controlplane ~ ➜  kubectl get replicaSet
No resources found in default namespace.controlplane ~ ➜  kubectl get replicaSet
NAME              DESIRED   CURRENT   READY   AGE
new-replica-set   4         4         0       6scontrolplane ~ ➜  kubectl describe replicaSet new-replica-set
Name:         new-replica-set
Namespace:    default
Selector:     name=busybox-pod
Labels:       <none>
Annotations:  <none>
Replicas:     4 current / 4 desired
Pods Status:  0 Running / 4 Waiting / 0 Succeeded / 0 Failed
Pod Template:Labels:  name=busybox-podContainers:busybox-container:Image:      busybox777Port:       <none>Host Port:  <none>Command:sh-cecho Hello Kubernetes! && sleep 3600Environment:   <none>Mounts:        <none>Volumes:         <none>Node-Selectors:  <none>Tolerations:     <none>
Events:Type    Reason            Age   From                   Message----    ------            ----  ----                   -------Normal  SuccessfulCreate  44s   replicaset-controller  Created pod: new-replica-set-g2tmxNormal  SuccessfulCreate  44s   replicaset-controller  Created pod: new-replica-set-hjk29Normal  SuccessfulCreate  44s   replicaset-controller  Created pod: new-replica-set-dxcscNormal  SuccessfulCreate  44s   replicaset-controller  Created pod: new-replica-set-7vm2xcontrolplane ~ ➜  kubectl delete pod new-replica-set-g2tmx
pod "new-replica-set-g2tmx" deletedcontrolplane ~ ➜  kubectl describe replicaSet new-replica-set
Name:         new-replica-set
Namespace:    default
Selector:     name=busybox-pod
Labels:       <none>
Annotations:  <none>
Replicas:     4 current / 4 desired
Pods Status:  0 Running / 4 Waiting / 0 Succeeded / 0 Failed
Pod Template:Labels:  name=busybox-podContainers:busybox-container:Image:      busybox777Port:       <none>Host Port:  <none>Command:sh-cecho Hello Kubernetes! && sleep 3600Environment:   <none>Mounts:        <none>Volumes:         <none>Node-Selectors:  <none>Tolerations:     <none>
Events:Type    Reason            Age    From                   Message----    ------            ----   ----                   -------Normal  SuccessfulCreate  2m45s  replicaset-controller  Created pod: new-replica-set-g2tmxNormal  SuccessfulCreate  2m45s  replicaset-controller  Created pod: new-replica-set-hjk29Normal  SuccessfulCreate  2m45s  replicaset-controller  Created pod: new-replica-set-dxcscNormal  SuccessfulCreate  2m45s  replicaset-controller  Created pod: new-replica-set-7vm2xNormal  SuccessfulCreate  12s    replicaset-controller  Created pod: new-replica-set-p5pm4controlplane ~ ➜  kubectl get pod
NAME                    READY   STATUS             RESTARTS   AGE
new-replica-set-7vm2x   0/1     ErrImagePull       0          3m5s
new-replica-set-dxcsc   0/1     ImagePullBackOff   0          3m5s
new-replica-set-hjk29   0/1     ErrImagePull       0          3m5s
new-replica-set-p5pm4   0/1     ErrImagePull       0          32scontrolplane ~ ➜  kubectl create -f /root/replicaset-definition-1.yaml
error: resource mapping not found for name: "replicaset-1" namespace: "" from "/root/replicaset-definition-1.yaml": no matches for kind "ReplicaSet" in version "v1"
ensure CRDs are installed firstcontrolplane ~ ✖ vim /root/replicaset-definition-1.yamlcontrolplane ~ ➜  vim /root/replicaset-definition-1.yamlcontrolplane ~ ➜  cat /root/replicaset-definition-1.yaml
apiVersion: v1
kind: ReplicaSet
metadata:name: replicaset-1
spec:replicas: 2selector:matchLabels:tier: frontendtemplate:metadata:labels:tier: frontendcontainers:- name: nginximage: nginx

http://www.whsansanxincailiao.cn/news/32029338.html

相关文章:

  • 东莞市建设网站首页/广州专门做seo的公司
  • 海淀周边网站建设/厦门seo培训学校
  • 盘锦做网站价格/网络运营推广具体做什么工作
  • 建设工程168网手机版下载/独立站seo是什么
  • 苏州网站推广工具/百度seo和sem
  • 忻府网站建设/注册网址
  • 课程介绍网站建设ppt模板/最近的国际新闻大事10条
  • wordpress 当前位置/网站seo检测
  • 专门给别人做网站/同城推广有什么平台
  • 永久免费制作动画的软件/seo顾问服务咨询
  • 搜狐广告收费标准/首页优化排名
  • 合肥做网站 卫来网络/seo工作流程
  • 建设银行北京东四支行网站/现在疫情怎么样了最新消息
  • 公司域名查询官方网站/网络营销工具
  • 成都手机网站建设哪/如何提高搜索引擎优化
  • 网站建设问卷调查/北京seo推广
  • 万全网站建设/国内专业的seo机构
  • 网站商城建设多少钱/电商平台推广公司
  • 电子商务网站建设特点/深圳seo网络推广
  • 苏州网站建设公司鹅鹅鹅/seo优化交流
  • 深圳罗湖网站建设公司哪家好/网络推广赚钱项目
  • 梁建国设计公司官网/电脑系统优化软件
  • 茶业网站设计方案/正规网络公司关键词排名优化
  • 网盘资源/北京seo公司公司
  • 服装网站建设进度及实施过程/推广产品的方式有哪些
  • 免费 网站 服务器/网络营销整合推广
  • 同一家公司可以做几个网站吗/成功的网络营销案例及分析
  • 畅销营销型网站建设电话/温州seo外包公司
  • 西安手机网站开发/如何制作一个自己的网页
  • 区政府网站建设管理计划/免费浏览网站推广