Kubernetes Replica Sets

ReplicaSet(RS)是Replication Controller(RC)的升级版本。ReplicaSet 和  Replication Controller之间的唯一区别是对选择器的支持。ReplicaSet支持labels user guide中描述的set-based选择器要求, 而Replication Controller仅支持equality-based的选择器要求。


大多数kubectl 支持Replication Controller 命令的也支持ReplicaSets。rolling-update命令除外,如果要使用rolling-update,请使用Deployments来实现。

虽然ReplicaSets可以独立使用,但它主要被 Deployments用作pod 机制的创建、删除和更新。当使用Deployment时,你不必担心创建pod的ReplicaSets,因为可以通过Deployment实现管理ReplicaSets。


ReplicaSet能确保运行指定数量的pod。然而,Deployment 是一个更高层次的概念,它能管理ReplicaSets,并提供对pod的更新等功能。因此,我们建议你使用Deployment来管理ReplicaSets,除非你需要自定义更新编排。

这意味着你可能永远不需要操作ReplicaSet对象,而是使用Deployment替代管理 。



apiVersion: extensions/v1beta1
kind: ReplicaSet
  name: frontend
  # these labels can be applied automatically
  # from the labels in the pod template if not set
  # labels:
    # app: guestbook
    # tier: frontend
  # this replicas value is default
  # modify it according to your case
  replicas: 3
  # selector can be applied automatically
  # from the labels in the pod template if not set,
  # but we are specifying the selector here to
  # demonstrate its usage.
      tier: frontend
      - {key: tier, operator: In, values: [frontend]}
        app: guestbook
        tier: frontend
      - name: php-redis
        image: gcr.io/google_samples/gb-frontend:v3
            cpu: 100m
            memory: 100Mi
        - name: GET_HOSTS_FROM
          value: dns
          # If your cluster config does not include a dns service, then to
          # instead access environment variables to find service host
          # info, comment out the 'value: dns' line above, and uncomment the
          # line below.
          # value: env
        - containerPort: 80


$ kubectl create -f frontend.yaml
replicaset "frontend" created
$ kubectl describe rs/frontend
Name:          frontend
Namespace:     default
Image(s):      gcr.io/google_samples/gb-frontend:v3
Selector:      tier=frontend,tier in (frontend)
Labels:        app=guestbook,tier=frontend
Replicas:      3 current / 3 desired
Pods Status:   3 Running / 0 Waiting / 0 Succeeded / 0 Failed
No volumes.
  FirstSeen    LastSeen    Count    From                SubobjectPath    Type        Reason            Message
  ---------    --------    -----    ----                -------------    --------    ------            -------
  1m           1m          1        {replicaset-controller }             Normal      SuccessfulCreate  Created pod: frontend-qhloh
  1m           1m          1        {replicaset-controller }             Normal      SuccessfulCreate  Created pod: frontend-dnjpy
  1m           1m          1        {replicaset-controller }             Normal      SuccessfulCreate  Created pod: frontend-9si5l
$ kubectl get pods
frontend-9si5l   1/1       Running   0          1m
frontend-dnjpy   1/1       Running   0          1m
frontend-qhloh   1/1       Running   0          1m

ReplicaSet as an Horizontal Pod Autoscaler target

ReplicaSet也可以作为 Horizontal Pod Autoscalers (HPA)的目标 。也就是说,一个ReplicaSet可以由一个HPA来自动伸缩。以下是针对我们在上一个示例中创建的ReplicaSet的HPA示例。

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
  name: frontend-scaler
    kind: ReplicaSet
    name: frontend
  minReplicas: 3
  maxReplicas: 10
  targetCPUUtilizationPercentage: 50
kubectl create -f hpa-rs.yaml




业精于勤 荒于嬉;行成于思 毁于随;

《Kubernetes Replica Sets》有63个想法

  1. Pingback: keto diet wiki
  2. Pingback: cost of priligy
  3. Pingback: viagra india pharmacy
  4. Pingback: ivermectin stromectol
  5. Pingback: amoxicillin dosage
  6. Pingback: ivermectin 3mg dose
  7. Pingback: furosemide cost uk
  8. Pingback: ivermectin us fda
  9. Pingback: ivermectin trial
  10. Pingback: stromectol
  11. Pingback: luckylands
  12. Pingback: ivermectin can
  13. Pingback: stromectol oral
  14. Pingback: cost of ivermectin
  15. Pingback: mazhor4sezon
  16. Pingback: ivermectin nz
  17. Pingback: buy stromectol canada
  18. Pingback: Gz92uNNH
  19. Pingback: do-posle-psihologa
  20. Pingback: bahis siteleri
  21. Pingback: stromectol 0 5 mg
  22. Pingback: JXNhGmmt
  23. Pingback: ivermectin 3mg tablet
  24. Pingback: confeitofilm
  25. We want to make certain our research and private pride with the assistance of best pay a person to do my homework online. Save some time with the assistance of assignments in all feasible subjects! Original, superb essay creator homework assist with inside the AU, Our mission offerings are to be had 24×7. Bright mission assists let you get the pleasant best carrier at less expensive expenses and be 100% lost from plagiarism. Contact “Need assignment helper” for Top Quality mission professional students can also additionally discover the mission trouble and supervisors’ expectancies tough to grasp, or they’ll now no longer have time to paint at the complicated wishes of the whole mission or lack the sturdy writing skills to ace online classes homework. We appear after your capabilities and permit you to collect awesome grades in each aspect. Get Assignment Help that makes a specialty of college students happiness and immediate pride.

  26. Pingback: film
  27. People think that they do not require SingaporeAssignment Helpfor their assignments but they don’t understand the value of this because any online assignment help site can help you in the perfect way because they have the expertise in their domain and they know that how to handle an assignment or what is the required way to do an assignment so that you can get quality grades or the grades that you want to achieve with the help of this.

  28. Pingback: custom writing
  29. Pingback: ooohd3.ru
  30. It’s actually a nice and helpful piece of info. Are you someone who makes stuff on Twitch and wants to stop those annoying ads? If that’s the case, I recommend you check out an article about Twitch streaming. In that article, you can learn how to stream on Twitch, and it also shows you how to block Twitch ads.

  31. Exceptional work on your Java assignment! Crafting programming assignments requires precision and attention to detail; your dedication shines through. When the intricacies of Java programming become overwhelming, turning to professional assistance, like java assignment help services, is a strategic decision demonstrating your commitment to achieving excellence in your coding tasks. Keep up the great work!



Time limit exceeded. Please complete the captcha once again.