模拟题目:

设置配置环境:

[candidate@node-1] $ kubectl config use-context k8s

Task

修改现有的 deployment probe-http 增加 readinessProbe 探测 器,规格如下:

使用 httpGet 进行探测
探测路径为 /healthz/return200
探测端口为 80
在执行第一次探测前应该等待 15 秒
执行探测的时间间隔为 20 秒

参考:

https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

file

解答:

切换环境

kubectl config use-context k8s

编辑 deployment probe-http 添加httpget就绪检测

        readinessProbe:
          httpGet:
            path: /healthz/return200
            port: 80
            scheme: HTTP
          initialDelaySeconds: 15
          periodSeconds: 20

file

查看pod

kubectl get pod

真实考试时的 yaml 文件内容如下: file