Application 기능으로 이해하기 - Probe 활용

Moongchi·2025년 6월 7일
0

kubernetes

목록 보기
10/14

▶ 응용1 : startupProbe가 실패 되도록 설정해서 Pod가 무한 재기동 상태가 되도록 설정해 보세요.

spec:
  template:
    spec:
      containers:
          startupProbe:
            httpGet:
              path: /startup
              port: 8080
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 5
            successThreshold: 1
            failureThreshold: 1 		# 36 -> 1 : 1회 health체크 실패하면 재기동

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

spec:
  template:
    spec:
      containers:
          livenessProbe:
            httpGet:
              path: /liveness
              port: 8080
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10		# 10 -> 60 : 상태체크 주기 1분
            successThreshold: 1
            failureThreshold: 3		# 상태체크 3회 실패 시 재기동
          readinessProbe:
            httpGet:
              path: /readiness
              port: 8080
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10		# 상태체크 주기 10초
            successThreshold: 1
            failureThreshold: 3		# 상태체크 3회 실패 시 트래픽 인입 중단
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      nodeSelector:
        kubernetes.io/hostname: k8s-master
      securityContext: {}
      schedulerName: default-scheduler

▶ 응용3 : Secret 파일(/usr/src/myapp/datasource/postgresql-info.yaml)이 존재하는지 체크하는 readinessProbe를 만들어 보세요.

spec:
  template:
    spec:
      containers:
          readinessProbe:
            exec:
              command:
                - cat
                - /usr/src/myapp/datasource/postgresql-info.yaml
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3

0개의 댓글