Created
May 13, 2019 13:34
-
-
Save arashkaffamanesh/bbd53de8f69cbc9f5142c7882fdaabda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oc project kubernauts | |
podname=$(oc get pods | grep postgres-$(oc get dc postgres -o jsonpath='{.status.latestVersion}') | grep -v deploy | grep Running | awk '{print $1}') | |
oc rsh -c postgres $podname | |
OR | |
oc get pods | grep postgres | |
oc exec -it postgres-pod-name bash | |
#Please change <user> to your desired name | |
POSTGRESQL_USER=<user> | |
POSTGRESQL_DATABASE=<user> | |
POSTGRESQL_PASSWORD=<user> | |
createuser $POSTGRESQL_USER ; | |
createdb --owner=$POSTGRESQL_USER $POSTGRESQL_DATABASE ; | |
psql --command "ALTER USER \"${POSTGRESQL_USER}\" WITH ENCRYPTED PASSWORD '${POSTGRESQL_PASSWORD}';" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment