Page
Guarantee application availability with OpenShift readiness
Now that you have deployed your rolling update, you're ready to create readiness probes.
In order to get full benefit from taking this lesson, you need to:
- A Developer Sandbox
- The OpenShift command-line interface (CLI) installed on your local PC
- Git installed on your local PC
In this lesson, you will:
- Log in to your Developer Sandbox
- Create a readiness probe
- Run a curl command
- Change deployment image
- Observe results
Log in to your OpenShift Sandbox at the command line
Log in to your OpenShift Sandbox by following these instructions.
Create a readiness probe for an existing deployment
Run the following command to create the readiness probe:
oc set probe deploy/myboot --readiness --get-url=http://:8080/health
Run a curl command loop to view the application output
Run the following command to see the URL of the application:
oc get routes
You will see output similar to the following:
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD myboot myboot-rhn-engineering-dschenck-dev.apps.sandbox.x8i5.p1.openshiftapps.com myboot http None
We will now run a curl command loop against this URL to see the application output. Replace the URL in the following command based on the results of the previous command (oc get routes) and enter it at a command line.
If you are using Bash:
for ((i=1;i<=10000;i++)); do curl http://myboot-rhn-engineering-foo-dev.apps.sandbox.x8i5.p1.openshiftapps.com; sleep .01; done;
If you are using PowerShell:
while ($true) { (curl myboot-rhn-engineering-foo-dev.apps.sandbox.x8i5.p1.openshiftapps.com).content;start-sleep -Milliseconds 200; }
Change deployment image to version 3
Run the following command to switch to the version 3 image for the myboot application:
oc set image deploy/myboot myboot=quay.io/rhdevelopers/myboot:v3
Observe rolling deployment results
As the command above is processed, you will see the output of the curl loop change. This is a result of the rolling update with zero downtime.
Congratulations. You've learned how to perform rolling updates of running applications and created readiness probes to guarantee your application's availability. The result? You can now update your OpenShift applications with a single command.
Learn more
Learn more about Kubernetes probes from these Red Hat resources: