I have been searching but I cannot find answer to my question.
What I am trying to do is to connect to remote shell of openshift container and create db dump, which works if i put username,password and db name by hand (real values).
I wish to execute this command to access env variables: (this command later will be part of bigger script)
oc rsh mon-rs-nr-0 mongodump --host=rs/mon-rs-nr-0.mon-rs-nr.xxx.svc.cluster.local,mon-rs-nr-1.xxx.svc.cluster.local,mon-rs-nr-2.mon-rs-nr.xxx.svc.cluster.local --username=$MONGODB_USER --password=$MONGODB_PASSWORD --authenticationDatabase=$MONGODB_DATABASE
But it is not working, I also tried different versions with echo etc. (env vars are not replaced to they values). Env vars are present inside container.
When I try
oc rsh mon-rs-nr-0 echo "$MONGODB_PASSWORD"
I recieve
$MONGODB_PASSWORD
But when i firstly connect to container and then execute command:
C:\Users\xxxx\Desktop>oc rsh mon-rs-nr-0
$ echo "$MONGODB_PASSWORD"
mAYXXXXXXXXXXX
It works. However I need to use it in a way I presented at the top, do somebody know workaround?