No bastion? No problem. Sometimes the best database client is just a pod that cleans up after itself.

1
2
3
4
5
6
# Launch temporary postgres client pod
kubectl run postgresql-client \
  --rm --tty -i \
  --restart='Never' \
  --image docker.io/postgres \
  --command -- bash

Once inside the pod:

1
2
3
4
5
# Connect to RDS
PGPASSWORD=my-short-long-pass psql \
  -h rds-endpoint-address \
  -U postgres \
  postgres

Why this works:

  • Pod runs inside EKS cluster network
  • Can reach RDS via security group rules
  • No need for bastion host or port forwarding
  • Auto-cleanup (--rm flag removes pod on exit)

Usage:

  1. First command creates temporary interactive pod
  2. Second command connects to RDS from within the pod
  3. Exit the shell to auto-delete the pod