[인프런 워밍업 클럽 4기 - DevOps] 미션 2. Probe 응용과제
4개월 전
▶ 응용1 : startupProbe가 실패 되도록 설정해서 Pod가 무한 재기동 상태가 되도록 설정해 보세요.
변경전
"startupProbe": {
"httpGet": {
"path": "/startup",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 5,
"successThreshold": 1,
"failureThreshold": 36
}
변경후
"startupProbe": {
"httpGet": {
"path": "/startup",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 5,
"successThreshold": 1,
"failureThreshold": 1 # startup의 failureThreshold의 값을 36 > 1로 변경
}
상태확인
"Startup probe failed." 라는 에러메세지가 반복적으로 발생

▶ 응용2 : 일시적 장애 상황(App 내부 부하 증가)가 시작 된 후, 30초 뒤에 트래픽이 중단되고, 3분 뒤에는 App이 재기동 되도록 설정해 보세요.
변경전
"livenessProbe": {
"httpGet": {
"path": "/liveness",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
"readinessProbe": {
"httpGet": {
"path": "/readiness",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
변경후
"livenessProbe": {
"httpGet": {
"path": "/liveness",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 60,
"successThreshold": 1,
"failureThreshold": 3 # 60초마다 3번 확인하여 실패시, 앱을 재기동
},
"readinessProbe": {
"httpGet": {
"path": "/readiness",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3 # 10초마다 3번씩 확인하여 실패시, 트래픽 중단
},
상태확인
부하를 준 후, 30초 후에 API 호출시 트래픽이 중단된 것을 확인

부하를 준 후, 대략 3분 후 앱이 재기동 되는 것을 확인

▶ 응용3 : Secret 파일(/usr/src/myapp/datasource/postgresql-info.yaml)이 존재하는지 체크하는 readinessProbe를 만들어 보세요.
변경전
"readinessProbe": {
"httpGet": {
"path": "/readiness",
"port": 8080,
"scheme": "HTTP"
},
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
변경후
"readinessProbe": {
"exec": {
"command": [
"sh",
"-c",
"[ -s /usr/src/myapp/datasource/postgresql-info.yaml ]"
]
}, # httpGet이 아니라 명령을 실행하도록 변경
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
상태확인
댓글을 작성해보세요.