[미션2] Probe > 응용과제

·2025년 6월 7일

1. startupProbe가 실패 되도록 설정해서 Pod가 무한 재기동 상태가 되도록 설정

설정:

startupProbe:
  httpGet:
    path: "/startup"
    port: 8080
  periodSeconds: 5
  failureThreshold: 1
readinessProbe:
  httpGet:
    path: "/readiness"
    port: 8080
  periodSeconds: 10
  failureThreshold: 3
livenessProbe:
  httpGet:
    path: "/liveness"
    port: 8080
  periodSeconds: 10
  failureThreshold: 3
kubectl edit deployment api-tester-1231 -n anotherclass-123

startupProbe의 failureThreshold를 20 -> 1로 수정하여
Pod가 무한 재기동 상태가 되도록 설정하였다.

결과:

pod의 STATUS가 [CrashLoopBackOff]이다.

2.일시적 장애 상황(App 내부 부하 증가)가 시작 된 후, 30초 뒤에 트래픽이 중단되고, 3분 뒤에는 App이 재기동 되도록 설정

설정:

startupProbe:
  httpGet:
    path: "/startup"
    port: 8080
  periodSeconds: 5
  failureThreshold: 10
readinessProbe:
  httpGet:
    path: "/readiness"
    port: 8080
  periodSeconds: 10
  failureThreshold: 3
livenessProbe:
  httpGet:
    path: "/liveness"
    port: 8080
  periodSeconds: 60
  failureThreshold: 3
  1. readinessProbe의 periodSeconds는 10초, failureThreshold는 3회로 설정하여
    30초 이후에 트래픽이 중단되도록 하였다.
  2. livenessProbe의 peroidSeconds는 60초, failureThreshold는 3회로 설정하여 3분후 재기동 되도록 하였다.

결과:

3. Secret 파일(/usr/src/myapp/datasource/postgresql-info.yaml)이 존재하는지 체크하는 readinessProbe 만들기

  1. deployment수정
kubectl edit deployment api-tester-1231 -n anotherclass-123
[root@k8s-master ~]# kubectl get pods -n anotherclass-123
NAME                               READY   STATUS             RESTARTS       AGE
api-tester-1231-7498dd8884-rvm56   1/1     Running            1 (132m ago)   136m
api-tester-1231-7f9dcd4878-xnhtv   0/1     CrashLoopBackOff   7 (68s ago)    7m8s
[root@k8s-master ~]# kubectl get pods api-tester-1231-7498dd8884-rvm56 -n anotherclass-123
NAME                               READY   STATUS    RESTARTS       AGE
api-tester-1231-7498dd8884-rvm56   1/1     Running   1 (132m ago)   136m
[root@k8s-master ~]# kubectl describe pod api-tester-1231-7498dd8884-rvm56 -n anotherclass-123
  1. describe로 확인
kubectl describe pod api-tester-1231-7498dd8884-rvm56 -n anotherclass-123

profile
DevOps를 기반으로 한 클라우드, 알고리즘, 백엔드 관심있는 컴공생

0개의 댓글