Post

Kubernetes - ReplicaSet

Kubernetes 기초

Kubernetes - ReplicaSet

ReplicaSet

  • ReplicaSet은 차세대 Replication Controller로 완전히 대체 가능함
  • 초기 쿠버네티스에서 제공했기 때문에 현장에서는 여전히 계속 사용중인 경우 존재
  • 일반적으로 ReplicaSet을 직접 생성하지 않고 상위 수준의 Deployment 리소스를 만들 때 자동으로 생성

    ReplicatSet & Replication Controller 차이점

Image

ReplicaSet 생성

replication 보다 업그레이드되었고 metchExp를 추가하여 label 조건에 더 자유롭

Image

ReplicaSet 실습

  • nginx 3개를 생성하는 rs-nginx 생성하라
  • rs-nginx pod의 개수를 10개로 스케일링하라

    nginx 3개를 생성하는 rs-nginx 생성하라

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: rs-nginx
spec:
  # modify replicas according to your case
  replicas: 3
  selector:
    matchLabels:
      app: replica
  template:
    metadata:
      labels:
        app: replica
    spec:
      containers:
      - name: rs-nginx
        image: nginx
1
kubectl creat -f yaml이름

rs-nginx pod의 개수를 10개로 스케일링하라

1
kubectl edit rs rs이름

Image

This post is licensed under CC BY 4.0 by the author.