How to deploy an application using Red Hat OpenShift Service on AWS

Learn how to deploy an application on a cluster using Red Hat OpenShift Service on AWS.


In this section, we'll take a look at how to configure OSToy using ConfigMaps, Secrets, and environment variables. This section won't cover these objects in detail (additional resources are provided for this purpose), but we will show you how they are exposed to the application.

What will you learn?

  • Configuration using ConfigMaps
  • Configuration using Secrets
  • Configuration using environmental secrets

What do you need before starting?

  • An application successfully deployed on a Red Hat OpenShift Service on AWS (ROSA) cluster 

Steps for configuring OSToy

Configuration using ConfigMaps

ConfigMaps allow you to decouple configuration artifacts from container image content to keep containerized applications portable.

  1. Click ConfigMaps in the left menu.
    • This will display the contents of the ConfigMap available to the OSToy application. We defined this in the ostoy-fe-deployment.yaml here:
kind: ConfigMap
apiVersion: v1
  name: ostoy-configmap-files
  config.json:  '{ "default": "123" }'

Configuration using Secrets

Kubernetes Secret objects allow you to store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys. Putting this information in a Secret is safer and more flexible than putting it verbatim into a Pod definition or a container image.

  1. Click Secrets in the left menu.
    • This will display the contents of the secrets available to the OSToy application. We defined this in the ostoy-fe-deployment.yaml here:
apiVersion: v1
kind: Secret
  name: ostoy-secret
type: Opaque

Configuration using environment variables

Using environment variables is an easy way to change application behavior without requiring code changes. It allows different deployments of the same application to potentially behave differently based on the environment variables. OpenShift makes it simple to set, view, and update environment variables for Pods/Deployments.

  1. Click ENV Variables in the left menu.
    • This displays the environment variables available to the OSToy application. We added three as defined in the deployment spec of ostoy-fe-deployment.yaml here:
      name: ostoy-configmap-env
      name: ostoy-secret-env
      key: ENV_TOY_SECRET
  • Note: You may have to do a CTRL+F to find them. Search for the three names above.

The last one, MICROSERVICE_NAME is used for the intra-cluster communications between pods for this application. The application looks for this environment variable to know how to access the microservice in order to get the colors.

Now that you have learned about configuration options, you are ready to learn about intra-cluster networking.

Get more support

More OpenShift resources

Previous resource
Storing and managing files in Red Hat OpenShift Service for AWS clusters
Next resource
How to network within Red Hat OpenShift Service on AWS clusters