[OpenShift] – How to create credentials for your application connect to an external service in the build time?

You can use the command  $oc secrets [options] Via the command $oc secrets --help you can see the available types.

Screen Shot 2018-04-19 at 11.31.06

Following an example to create a new secret for a basic authentication.

$oc secrets new-basicauth myapp-secret --username=admin --password=admin123

After creating the secret is required to attach it to your build config via the command $oc set build-secret --source  Following an example to attach the secret created above to a build config object.

$oc set build-secret --source bc/myapp myapp-secret

If you edit the build config you will see that the secret was added to the file as the following example. ($oc edit bc/myapp)

Screen Shot 2018-04-19 at 11.44.26

For further information check the OpenShift Developer Guide.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s