Skip to main content
Welcome. In this lesson you’ll create a reusable OpenShift Template that packages the Example Voting Application (Secrets, BuildConfigs, ImageStreams, DeploymentConfigs, Services, and Routes) into a single catalog item. Once added to a project catalog, other developers can deploy the full voting stack via the catalog wizard. What you’ll accomplish
  • Identify the resources that make up the voting app (Secrets, BuildConfigs, ImageStreams, DeploymentConfigs, Services, Routes).
  • Export and clean each resource’s YAML, then assemble them under the Template’s objects: array.
  • Create the Template in a project and add it to the catalog.
  • Optionally parameterize values so the catalog wizard prompts users for inputs.
Quick steps (at-a-glance) Recommended SEO keywords: OpenShift Template, custom catalog, example voting app, BuildConfig, ImageStream, DeploymentConfig, Route, Secrets.

1. Create the Template file

Create a file named example-voting-app-template.yml. Start with the Template API version, kind, and metadata. Use openshift.io/display-name as an annotation if you want a friendly label to appear in the catalog.
The objects array will contain a list of resource manifests (each item prefixed with -). Populate this array with cleaned YAML documents for Secrets, BuildConfigs, ImageStreams, DeploymentConfigs, Services, and Routes.

2. Secrets

Start with Secrets because multiple components reference DB and Redis credentials. In the OpenShift Console, open each Secret → Actions → Edit YAML and copy it into the template. Remove runtime metadata fields such as creationTimestamp, resourceVersion, uid, selfLink, and status. Use stringData in the template for clear-text values so users (or parameters) can provide plaintext values which the API converts to base64. Example cleaned DB Secret entry to include under objects::
A screenshot of the OpenShift Origin web console showing the "Example Voting Application" Secrets page for a "db" entry, with labels/tags for a postgresql-persistent template and masked database-name, database-password, and database-user values. The left sidebar navigation and action buttons (Add to Application / Actions) are also visible.
Repeat for the Redis secret and keep only necessary fields:
Tip: Consider converting these values into Template parameters so the catalog wizard prompts users for credentials instead of hard-coding them in the template.

3. BuildConfigs

Export each BuildConfig from the project, then remove unnecessary metadata and status. Keep the spec (source Git repo, contextDir, build strategy, triggers, environment variables, etc.). Consider parameterizing the Git URL and branch. Example cleaned BuildConfig for the result app:
Repeat for vote and worker BuildConfigs, adjusting contextDir and labels.

4. ImageStreams

Include ImageStream resources so OpenShift can resolve image references and trigger rebuilds/rollouts. Keep the name and the minimal spec required.
Local image build/push hint: If you build images locally and push to the integrated OpenShift registry, tag and push using the registry host and project namespace:

5. DeploymentConfigs

Export and clean DeploymentConfig resources, removing status and runtime metadata while preserving spec. Keep container images, environment variables (use valueFrom.secretKeyRef for secrets), probes, resource limits, and ports. Example db DeploymentConfig entry:
Repeat similar cleanup for vote, result, worker, and redis DeploymentConfigs.

6. Services and Routes

Add Service objects for in-cluster networking. The worker service is optional if nothing targets it, but including it maintains consistency. Example Service for worker:
A screenshot of the OpenShift Origin web console showing the "Services" page for an "Example Voting Application," listing services (worker, result, db, vote, redis) with their Cluster IPs, ports, selectors, and ages. The left sidebar shows navigation items like Applications, Builds, Resources, Storage, Monitoring, and Catalog.
Add Services for result, vote, and db. Then add Route objects for vote and result so they are reachable externally.

7. Create the Template in OpenShift (CLI)

When your example-voting-app-template.yml is complete, create it in a project where you have permission (for example voting-application-3). If you attempt to create it in the default namespace as a normal user, you’ll get a Forbidden error.
If you run oc create -f without specifying a project and you are not a cluster admin, OpenShift will likely reject the request. Always target a project/namespace where you have permission, e.g. -n voting-application-3.
Example Minishift environment setup (Windows) — see Minishift docs for details: Minishift documentation.
Set the PATH (Windows example):
A typical forbidden error looks like this:
Create the Template in a project you control:
After creating the Template, refresh the OpenShift web console catalog; the new item example-voting-app-template should appear. Click it and run the wizard to deploy the voting stack.

8. Monitoring the deployment

Open the Overview / Monitoring page to watch builds, pods, and events as the application starts. Allow builds and pods time to finish, then open the vote and result routes to verify front-ends.
A screenshot of the OpenShift Origin web console showing the "Example Voting Application" Monitoring page, listing Pods (result, vote, db, redis, etc.) and their statuses (Running, Container Creating). The left sidebar shows navigation options like Overview, Applications, Builds, Resources, Storage, Monitoring, and Catalog.

9. Improve the Template (best practices)

To make the Template friendly and reusable:
  • Parameterize values that are likely to change: Git repository URL, branch/ref, image tag, project namespace, database credentials.
  • Add parameters: entries at the top-level of the Template with name, displayName, description, required, and value so the catalog wizard asks for them.
  • Avoid embedding plaintext credentials in the template. Use stringData with parameters or let users supply secrets during the wizard.
  • Provide helpful annotations and labels (for display name, description, and categorization in the catalog).
See OpenShift templates documentation for parameter examples and best practices: https://docs.openshift.com/container-platform/latest/openshift_images/using-templates.html
Tip: Use Template parameters for values that change often (git repo, branch, image tag, database credentials). Parameters allow the catalog wizard to prompt users instead of requiring manual file edits.

That completes this lesson on creating a custom catalog template for the Example Voting Application. You now have the steps to export, clean, assemble, and publish an OpenShift Template so others can deploy the full application stack from the catalog. Thank you.

Watch Video