Kubernetes - ReplicaSet

요약

Kubernetes 기초

Kubernetes 큰 주제 아래에서 세부 개념과 실습 절차를 연결하기 위한 노트입니다.

핵심 포인트

  • Kubernetes 기초
  • ReplicaSet
  • ReplicatSet & Replication Controller 차이점
  • ReplicaSet 생성
  • ReplicaSet 실습

지식 그래프

정리 내용

ReplicaSet

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

ReplicatSet & Replication Controller 차이점

ReplicaSet 생성

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

ReplicaSet 실습

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

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

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
kubectl creat -f yaml이름

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

kubectl edit rs rs이름

출처