当前位置:网站首页>Replicationcontroller and replicaset of kubernetes
Replicationcontroller and replicaset of kubernetes
2022-07-26 16:28:00 【keyson R】
kubernetes And ReplicationController And ReplicaSet
List of articles
ReplicationController Part of the
One ReplicationController There are three main parts :
label selector( tag chooser ): Used to determine theReplicationControllerWhat's in scopepod.replica count( Number of copies ): Specify thepodNumber .pod template(pod Templates ): Used to create a newpodcopy .
The above three parts can be modified at any time , among replica count That is, the change of the number of copies will affect the existing pod. Change the label selector
Will make the existing pod Out of the ReplicationController The scope of the , So the controller stops paying attention to them .
Use ReplicationController The benefits of
- Ensure a
podOr morepodThe copy runs continuously , The way is nowpodStart a new one when lostpod. - When a cluster node fails , It will be all of the... Running on the failed node
pod( Immediate acceptanceReplicationControllerOn the control nodepod) Create alternate copies . - It can be easily realized
podThe horizontal expansion of .
edit ReplicationController
View owned rc:kubectl get rc
edit rc:kubectl edit re kubia
Delete ReplicationController And keep pod The normal operation
When using kubectl delete Delete ReplicationController when , You can add --cascade=false Options to keep pod function .
namely :kubectl delete rc kubia --cascade=false
Use ReplicaSet instead of ReplicationController
ReplicaSet It's a new generation of ReplicationController, And completely replace the old , namely ReplicationController Will eventually be discarded .
That is to say, we should create ReplicaSet instead of ReplicationController, They're almost identical , So there will be no learning cost .
ReplicaSet What are the advantages of ?
Its pod Selectors are more expressive . for instance , Single ReplicationController Cannot be pod And labels env=a And env=b Simultaneous matching , It can only match with
Yes env=a Label or env=b Labeled pod. but ReplicaSet Can match two groups pod And treat them as a large group .
Can pass matchExpressions Property to override the selector , Such as some examples :
selector:
matchExpressions:
- key: app # This selector requires this pod Contains the name app The label of
operator: In
values:
- dev # The tag value must be values value : namely dev
Example above , Each expression must contain a key, One operator( Operator ), And there may be another values A list of ( Depends on the running symbol ).
Valid running symbol :
In:LabelThe value of must match one of the specifiedvaluesmatching .NotIn:LabelWith any specified valuevaluesMismatch .Exists:podMust contain a label with the specified name , Value doesn't matter , When using this operator , You should not specifyvaluesField .DoesNotExist:podMust not contain a label with the specified name .valuesProperty must not specify .
It should be noted that , If more than one expression is specified , Then all of these expressions must be true To make the selector and pod matching . If you also specify matchLabels and matchExpressions,
Then all tags must match , And all expressions must be calculated as true, To make this pod Match selector .
How to define ReplicaSet?
The same is to create yaml file , But here's the thing ReplicaSet No V1 API Part of , But it belongs to apps API Of the group v1beta2 edition . So you need to make sure that in
Specify the correct... When creating resources apiVersion. except kind Need by ReplicationController Change to ReplicaSet, Other content and creation ReplicationController Almost the same .
It is worth noting that ReplicaSet The abbreviation is rs. May be through kubectl get rs Check it out. ReplicaSet.
Reference books :《Kubernetes in action》
边栏推荐
- The difference between oncreate and onrestoreinstancestate recovery data of activity
- How to test the circle of friends (mind map)
- 初识OpenGL (2)编译着色器
- Clojure Web 开发-- Ring 使用指南
- C # set different text watermarks for each page of word
- kubernetes之ConfigMap
- Test cases should never be used casually, recording the thinking caused by the exception of a test case
- 阿里云DMS MySQL云数据库建表报错,求解!!
- 可信隐私计算框架“隐语”开源专家观点集锦
- 6种方法帮你搞定SimpleDateFormat类不是线程安全的问题
猜你喜欢
随机推荐
Clojure operation principle bytecode generation
修改mysql数据库root用户的密码
Final consistency distributed transaction TCC
Bugku login2
docker安装redis?如何配置持久化策略?
Selection of industrial serial port to WiFi port to Ethernet module of Internet of things
Bugku login1
[tool sharing] automatic generation of file directory structure tool mddir
【万字长文】使用 LSM-Tree 思想基于.Net 6.0 C# 实现 KV 数据库(案例版)
2022牛客暑期多校训练营1(ACDGIJ)
PAT甲级 1050 String Subtraction
十周岁生日快乐,Clojure
JS API summary of Array Operations
2022 latest Beijing Construction Safety Officer simulation question bank and answers
I would like to ask you guys, how to specify the character set of MySQL CDC tables? I can't find the corresponding connector parameters on the official website. I read one
研发效能的道与术 - 道篇
Pat grade a 1049 counting ones
Test cases should never be used casually, recording the thinking caused by the exception of a test case
6种方法帮你搞定SimpleDateFormat类不是线程安全的问题
Tao and art of R & D Efficiency - Tao chapter









