Created
August 14, 2022 22:38
-
-
Save brianpursley/26d5805236db3fca1453dcde5bd984e9 to your computer and use it in GitHub Desktop.
Script to start a postgres pod, forward port 5432 locally, and cleanup on exit
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
#!/bin/sh | |
kubectl run postgres --image=postgres --env=POSTGRES_PASSWORD=hunter2 | |
kubectl wait --for=condition=Ready pod/postgres | |
cleanup() { | |
echo | |
kubectl delete pod postgres --now | |
} | |
trap cleanup INT | |
kubectl port-forward postgres 5432 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment