Bootstrap FreeKB - OpenShift - Deploy an application from a template
OpenShift - Deploy an application from a template

Updated:   |  OpenShift articles

A deployment is used to manage the pods that are created to run an application. The deployment ensures that the desired number of pod replicas are running and can handle updates to the application by rolling out new versions of the pods. The deployment creates and manages a replica set, which in turn manages the pods.

flowchart TB subgraph Project["OpenShift Project/Namespace"] Deployment[Deployment] Replica_Set[Replica Set] subgraph Pods["Pod Replicas"] Pod1[Pod 1
Container] Pod2[Pod 2
Container] Pod3[Pod 3
Container] end end Deployment -->|Creates/Manages| Replica_Set Replica_Set -->|Manages| Pod1 Replica_Set -->|Manages| Pod2 Replica_Set -->|Manages| Pod3 style Deployment fill:#90CAF9 style Replica_Set fill:#FFE082 style Pods fill:#FFCCBC

It is also noteworthy that a route provides a URL that can be used to access the application from outside the OpenShift cluster. For example, if the route is configured to use the hostname myapp.mydomain.com, then users can access the application by navigating to http://myapp.mydomain.com. The route will forward the request to the service, which will then forward the request to one of the pods that are running the application.

flowchart LR subgraph Project["OpenShift Project/Namespace"] subgraph Pods["Pod Replicas"] Pod1[Pod 1
Container] Pod2[Pod 2
Container] Pod3[Pod 3
Container] end SVC[Service] Route[Route] end USER[External User] --> Route --> SVC SVC --> Pod1 SVC --> Pod2 SVC --> Pod3 style SVC fill:#A5D6A7 style Pods fill:#FFCCBC style USER fill:#CE93D8

There are various ways to deploy an app.

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.openshift.example.com' 
    Access your application via route 'secure-sso-sso.apps.openshift.example.com' 
    Run 'oc status' to view your app.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 553431 in the box below so that we can be sure you are a human.