// Module included in the following assemblies: // // * getting-started/openshift-cli.adoc :_mod-docs-content-type: PROCEDURE [id="getting-started-cli-creating-secret_{context}"] = Creating a secret The `Secret` object provides a mechanism to hold sensitive information such as passwords, {product-title} client configuration files, private source repository credentials, and so on. Secrets decouple sensitive content from the pods. You can mount secrets into containers using a volume plugin or the system can use secrets to perform actions on behalf of a pod. The following procedure adds the secret `nationalparks-mongodb-parameters` and mounts it to the `nationalparks` workload. .Prerequisites * You must have access to an {product-title} cluster. * You must have installed the OpenShift CLI (`oc`). * You have a deployed image. .Procedure . To create a secret, enter the following command: + [source,terminal] ---- $ oc create secret generic nationalparks-mongodb-parameters --from-literal=DATABASE_SERVICE_NAME=mongodb-nationalparks --from-literal=MONGODB_USER=mongodb --from-literal=MONGODB_PASSWORD=mongodb --from-literal=MONGODB_DATABASE=mongodb --from-literal=MONGODB_ADMIN_PASSWORD=mongodb ---- + .Example output + [source,terminal] ---- secret/nationalparks-mongodb-parameters created ---- . To update the environment variable to attach the mongodb secret to the `nationalpartks` workload, enter the following command: + [source,terminal] ----- $ oc set env --from=secret/nationalparks-mongodb-parameters deploy/nationalparks ----- + .Example output + [source,terminal] ---- deployment.apps/nationalparks updated ---- . To show the status of the `nationalparks` deployment, enter the following command: + [source,terminal] ---- $ oc rollout status deployment nationalparks ---- + .Example output + [source,terminal] ---- deployment "nationalparks" successfully rolled out ---- . To show the status of the `mongodb-nationalparks` deployment, enter the following command: + [source,terminal] ---- $ oc rollout status deployment mongodb-nationalparks ---- + .Example output + [source,terminal] ---- deployment "mongodb-nationalparks" successfully rolled out ----