- Create project
> oc new-project link-example- Create a new app, based on s2i strategy
> oc new-app --name service-delay -i java:8 https://github.com/rofrba/examples-openshift --context-dir delay -e DELAY=1- Expose the service
> oc expose svc service-delay- Check the API and check the delay
> curl $(oc get route -o jsonpath='{..spec.host}{"\n"}')- Activate readiness and liveness probes for the application.
> oc set probe dc/service-delay --liveness --get-url=http://:8080/ --initial-delay-seconds=2 --timeout-seconds=2oc set probe dc/service-delay --readiness --get-url=http://:8080/ --initial-delay-seconds=2 --timeout-seconds=2- Change the delay value again and verify the pod status
> oc set env dc/service-delay DELAY=5> oc get pods- service-delay-4-nsj2k 1/1 Running 0 107s
- service-delay-5-6hs7d 0/1 Running 1 42s
- service-delay-5-deploy 1/1 Running 0 46s
We see that the pod restarts multiple times and never gets ready because the readiness probe gets no response within the allotted timeout
- Change the delay to pass the readiness probe
> oc set env dc/service-delay DELAY=1- Now we see that the new pod was created and is ready to receive traffic
- service-delay-4-nsj2k 0/1 Terminating 0 5m37s
- service-delay-6-deploy 0/1 Completed 0 22s
- service-delay-6-xq9xs 1/1 Running 0 16s