0

I have a python code that needs to read data from a restricted DB2. I do know about secrets in build configs of Openshift,however I did not get any which can be useful like this. Also what should be the appropriate syntax in my code to read from that Secret. Kindly help.

sayan_sen
  • 345
  • 4
  • 15

1 Answers1

0

There's a couple of options of using secrets or configMaps in DeploymentConfig for your scenario:

  • Propagate data through environment variables
  • Mount secret as a volume

There're both examples

I suggest to propagate password through secretKeyRef environment variable:

env:
  - name: DB2_PASSWORD
    valueFrom:
      secretKeyRef:
        name: bd2-password
        key: password

To create secret:

oc create secret generic db2-password --from-literal=password=Qwerty123
Oligzeev
  • 511
  • 3
  • 7