This shell script simplifies connecting to a PostgreSQL Cluster deployed by Zalando Postgres Operator.
The script performs the following actions:
- Retrieves the master pod's name
- Fetches the password for the specified user
- Prints port forwarding and connection instructions
Make sure you have the necessary permissions and configurations set up in your environment before executing the script.
chmod +x pg.shRun the script using the following format:
./pg.sh [K8S_NS] [PG_CLUSTER_NAME] [PG_USER] [PG_DATABASE]Replace the placeholders with the specific values for your environment:
K8S_NS: Kubernetes Namespace where the PostgreSQL cluster is deployed.PG_CLUSTER_NAME: Name of the PostgreSQL cluster.PG_USER: Username for connecting to the PostgreSQL cluster.PG_DATABASE: Name of the PostgreSQL database.
./pg.sh acme acme-cluster acme-user acme-db