Create an application from OpenShift Template
- 21 Dec, 2021
Openshift comes with a set of default templates, you can use oc get templates -n openshift to show them
Each template contains specifc sections
- The objects section: defines a list of resources that will be created
- The parameters section: defines parameters that are used in the template objects
1 - Inspect the template file for the parameters
I export the postgresql-ephemeral to a yaml file using : oc get template postgresql-ephemeral -o yaml -n openshift > postgresql.yaml
Then inspect the yaml file oc process --parameters -f <filename.yaml>
2 - Create the application using oc process
oc process -f postgresql.yaml -l app=mydb -p DATABASE_SERVICE_NAME=dbservice -p POSTGRESQL_USER=dbuser \
-p POSTGRESQL_PASSWORD=yourpassword -p POSTGRESQL_DATABASE=books | oc create -f -