此内容没有您所选择的语言版本。

Chapter 5. Migrating Application to OpenShift 4


The YAML configuration of probes must be adjusted when migrating to OpenShift 4.

On OpenShift 3.11, the default YAML configuration for liveness probes is similar to the following code example:

Example YAML Configuration for OpenShift 3.11 Liveness Probe

livenessProbe:
        exec:
          command:
            - /bin/bash
            - '-c'
            - /opt/eap/bin/livenessProbe.sh
        initialDelaySeconds: 60
        periodSeconds: 10
        successThreshold: 1
        failureThreshold: 3
Copy to Clipboard Toggle word wrap

In this example, the liveness probe is located at /opt/eap/bin/livenessProbe.sh within the JBoss EAP image. The probe is triggered the first time after a 60 second initial delay and then every 10 seconds after a pod is started on the JBoss EAP server.

The probe is considered a failure after 3 attempts to call the livenessProbe.sh script. The container is deemed unhealthy, and OpenShift will restart the JBoss EAP container in its respective pod.

On OpenShift 3.11, a single call lasts 5 seconds before it returns as a success or failure. On OpenShift 4, a single call lasts less than 1 second.

On OpenShift 3.11, a call to the probe lasts 5 seconds, followed by a 10 second waiting period. This means that 3 calls last approximately 35 seconds before the container inside the pod is restarted if the JBoss EAP image is unhealthy.

On OpenShift 4, 3 calls last approximately 23 seconds. The configuration of the probe for OpenShift 4 should be adjusted in the YAML configuration as follows:

Example YAML Configuration for OpenShift 4 Liveness Probe

livenessProbe:
        exec:
          command:
            - /bin/bash
            - '-c'
            - /opt/eap/bin/livenessProbe.sh
        initialDelaySeconds: 60
        periodSeconds: 16
        successThreshold: 1
        failureThreshold: 3
Copy to Clipboard Toggle word wrap

In this example, periodSeconds has been increased by 6 seconds. Now the first call lasts 1 second, followed by a 16 second waiting period. Three calls would last approximately 34 seconds, which is nearly equivalent to the OpenShift 3.11 behavior of the probe.

For readiness probes, a similar adjustment must be made to the YAML configuration:

Example YAML Configuration for OpenShift 4 Readiness Probe

readinessProbe:
        exec:
          command:
            - /bin/bash
            - '-c'
            - /opt/eap/bin/readinessProbe.sh
        initialDelaySeconds: 10
        periodSeconds: 16
        successThreshold: 1
        failureThreshold: 3
Copy to Clipboard Toggle word wrap

Additional Resources

Liveness and Readiness Probes

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat