OpenShift - Deploy an application from a template

by
Jeremy Canfield |
Updated: August 20 2024
| OpenShift articles
An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.
There are various ways to deploy an app.
- From GitHub (https://github.com)
- From Docker Hub (https://hub.docker.com)
- From an image
- From a build
- From a template (this article)
- From a JSON or YAML file (templates)
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
The oc get templates command can be used to list templates that can be used to deploy an app. For example, if you want to deploy the Red Hat SSO app, the following command could be used to return the Red Hat SSO templates.
~]$ oc get templates --namespace openshift --output name | grep -o 'sso76.\+' | sort
sso76-https
sso76-ocp3-x509-https
sso76-ocp3-x509-postgresql-persistent
sso76-ocp4-https
sso76-ocp4-postgresql
sso76-ocp4-postgresql-persistent
sso76-ocp4-x509-https
sso76-ocp4-x509-postgresql-persistent
sso76-postgresql
sso76-postgresql-persistent
And then the oc new-app command with the --templates option can be used to deploy an app using a template.
~]$ oc new-app --template=sso76-ocp4-https
--> Deploying template "sso/sso76-ocp4-https" to project sso
Red Hat Single Sign-On 7.6 on OpenJDK (Ephemeral with passthrough TLS)
---------
An example application based on RH-SSO 7.6 on OpenJDK image. For more information about using this template, see https://github.com/jboss-container-images/redhat-sso-7-openshift-image/tree/sso76-dev/docs.
A new RH-SSO service has been created in your project. The admin username/password for accessing the master realm via the RH-SSO console is ak1AGGUE/jRnryJyj. Please be sure to create the following secrets: "sso-app-secret" containing the keystore.jks file used for serving secure content; "sso-app-secret" containing the jgroups.jceks file used for securing JGroups communications; "sso-app-secret" containing the file used for securing RH-SSO requests. To enable also dual-network clusters that support both IPv4 and IPv6 address families, all services defined by this template are configured having the 'spec.ipFamilyPolicy' field set to 'PreferDualStack' by default.
* With parameters:
* Application Name=sso
* Custom http Route Hostname=
* Custom https Route Hostname=
* Custom RH-SSO Server Hostname=
* Server Keystore Secret Name=sso-app-secret
* Server Keystore Filename=keystore.jks
* Server Keystore Type=
* Server Certificate Name=
* Server Keystore Password=
* Datasource Minimum Pool Size=
* Datasource Maximum Pool Size=
* Datasource Transaction Isolation=
* JGroups Secret Name=sso-app-secret
* JGroups Keystore Filename=jgroups.jceks
* JGroups Certificate Name=
* JGroups Keystore Password=
* JGroups Cluster Password=nSitrrbg # generated
* ImageStream Namespace=openshift
* RH-SSO Administrator Username=ak1AGGUE # generated
* RH-SSO Administrator Password=jRnryJyj # generated
* RH-SSO Realm=
* RH-SSO Service Username=
* RH-SSO Service Password=
* RH-SSO Trust Store=
* RH-SSO Trust Store Password=
* RH-SSO Trust Store Secret=sso-app-secret
* Container Memory Limit=1Gi
--> Creating resources ...
service "sso" created
service "secure-sso" created
service "sso-ping" created
route.route.openshift.io "sso" created
route.route.openshift.io "secure-sso" created
Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
deploymentconfig.apps.openshift.io "sso" created
--> Success
Access your application via route 'sso-sso.apps.lab001.op.thrivent.com'
Access your application via route 'secure-sso-sso.apps.lab001.op.thrivent.com'
Run 'oc status' to view your app.
Did you find this article helpful?
If so, consider buying me a coffee over at