Skip to main content
Welcome — this guide shows how to package the Example Voting Application into a reusable OpenShift Template and add it to the cluster catalog. After following these steps, other developers can deploy the full voting stack (builds, images, deployments, services, and routes) through the catalog UI in just a few clicks. What you’ll accomplish
  • Identify and collect all Kubernetes/OpenShift objects required by the app (Secrets, ImageStreams, BuildConfigs, DeploymentConfigs, Services, Routes).
  • Consolidate and clean each object’s YAML into a single Template file.
  • Create the Template in your project (CLI or console).
  • Deploy and test the Template from the catalog.
Plan
  • Inspect resources in the project and copy their YAML definitions.
  • Remove runtime fields (status, creationTimestamp, resourceVersion, selfLink, uid, labels that are not required).
  • Replace base64-encoded secrets with stringData for readability (you can parameterize later).
  • Add parameters to the Template for reusability (Git repo, tags, passwords, namespace).
  • Create the Template and verify via Builds/Pods/Routes.
Create the template file Create a file named example-voting-app-template.yml.
A dark IDE screen showing a "New File" dialog box with an input field containing "example-voting-app-templa" and OK/Cancel buttons. The background also displays the prompt "Search Everywhere Double Shift."
Start the file with the Template header and an objects array that will contain all resources:
Important: a Template must include every resource required to deploy the application — BuildConfigs, DeploymentConfigs, Services, Routes, ImageStreams, Secrets, etc. Key resources and a quick reference Secrets Start the Template with Secrets so other objects can reference them. In the OpenShift Console go to Resources → Secrets, select the DB and Redis secrets and choose “Edit YAML” to copy. Remove fields like creationTimestamp, resourceVersion, selfLink, uid, and unnecessary labels. Use stringData to provide readable values; OpenShift converts them to base64 when creating the Secret. Example cleaned DB Secret:
Example cleaned Redis Secret:
Note: these values should be parameterized later so catalog users can provide secure values via the catalog wizard. BuildConfigs Collect and clean each BuildConfig in the project. Keep spec.source (git URI and contextDir), spec.strategy, spec.output, and spec.triggers. Remove the status section and other runtime metadata. You can initially hard-code the repository URL and later move it to Template parameters. Example BuildConfig for result:
Repeat the same cleanup for the vote and worker BuildConfigs. ImageStreams Add minimal ImageStream objects (one per application image). Keep only essential metadata.name and spec.lookupPolicy:
If you build or push images manually into the internal registry, example docker commands:
DeploymentConfigs Copy your DeploymentConfig YAML, then remove status and ephemeral metadata. Keep spec.replicas, spec.selector, and the spec.template.spec.containers definition (image, env, ports, probes). Reference secrets with valueFrom.secretKeyRef so the deployed pods pick up credentials from the Secrets added above. Example DeploymentConfig for PostgreSQL (db):
Repeat similar cleanup for the application DeploymentConfigs (result, vote, worker, redis). Keep liveness/readiness probes, env vars, and ports. Remove status from copied YAML. Services and Routes Add Service objects for components that must be addressable inside the cluster. The worker may not need a Service unless another component connects to it — but including Services in the Template preserves expected topology. Example Service for worker:
Add Services for result, vote, db, and redis as required by your app. Create minimal Route objects for externally exposed services (one per app you want publicly accessible). Example Route for vote:
Parameterize the Template To make the Template reusable and friendly in the Catalog wizard, move configurable items into parameters. Typical parameters:
  • Git repository URL and ref
  • Image tags (e.g. result:latest)
  • Secret values (database-password, redis-password)
  • Target namespace/project (or avoid hard-coding namespace and let users deploy into current project)
  • Resource sizes or replica counts
Example parameter snippet to add near the top of your Template:
Then reference parameters in object fields using ${PARAM_NAME} substitution. Creating the Template with oc (CLI) After finalizing example-voting-app-template.yml, create the Template with oc. The example below demonstrates configuring oc via Minishift on Windows, logging in, and creating the Template in a project. Add oc to PATH (example Minishift output):
Apply the environment change (Windows example):
Important: if you try to create a Template in default without the right permissions, you’ll see a forbidden error. Create the Template in a project where you have rights or specify -n <project>. Example (insufficient privileges):
Create the Template in the target project (example: voting-application-3):
Using the template from the catalog Refresh the OpenShift Console Catalog view. You should see a new catalog item called example voting app template (or the display name set in your Template’s metadata/annotations). Click it and follow the wizard to deploy the application stack. During the wizard you can supply the parameter values you defined.
A screenshot of the OpenShift Origin web console for the "Example Voting Application" showing a secret named "db" with database-name, database-password, and database-user values masked. The left navigation (Overview, Applications, Builds, Resources, etc.) is visible and there are "Add to Application" and "Actions" buttons on the page.
Open the Monitoring / Overview page to watch pod creation and build progress. The Overview shows pods, builds, and overall application health so you can follow progress in real time.
A screenshot of the OpenShift Origin web console showing the Monitoring page for an "Example Voting Application," listing pods and their statuses. The pod list includes entries like result-1, vote-1, db-1 and redis with statuses such as Running or Container Creating.
When builds complete and pods are Running, open Links → Routes to access the voting UI and the results page.
A screenshot of the OpenShift Origin web console showing the "Services" page for an "Example Voting Application." It lists services (worker, result, db, vote, redis) with their Cluster IPs, ports, selectors, and ages.
Improve and maintain your Template
  • Parameterize values (Git URLs, secrets, image tags, replica counts, namespace) and provide defaults and descriptions for a good catalog experience.
  • Reuse parameter names and patterns from builtin OpenShift templates for consistency.
  • Test the Template by creating from the catalog and by oc create -f locally.
  • Keep sensitive defaults empty; require users to input credentials or generate them securely.
Tip: Review existing OpenShift templates in the cluster (oc get templates -n openshift) to learn common parameter names and patterns you can reuse.
Links and references Thanks for following this demo — you now have the steps needed to package an application into a reusable OpenShift Template and publish it to your cluster catalog.

Watch Video