Last active
June 9, 2020 17:17
-
-
Save edonosotti/90df8cd83401d1eaec0ce9621bfec8a3 to your computer and use it in GitHub Desktop.
Quick PostgreSQL Maintenance Access in Kubernetes
This file contains hidden or 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
#!/bin/bash | |
# Scenario: the database server is running outside of Kubernetes | |
# and it is in a private network. | |
# The database connection string is stored into a ConfigMap named: | |
# `MY_CONFIG_MAP` and its variable name is: `DATABASE_CONNECTION_STRING`. | |
# We don't want to copy & paste the connection string into the | |
# command line, we want it to be automatically pulled from the config and | |
# piped into the command. | |
kubectl run -i --tty --rm pgclient --image=jbergknoff/postgresql-client \ | |
`kubectl get configmap MY_CONFIG_MAP -o=jsonpath='{.data.DATABASE_CONNECTION_STRING}'` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment