restore_pg 274 B

123456
  1. BACKUP=$1
  2. kubectl cp ${BACKUP} $(kubectl get pods | grep -e ^postgres | awk '{print $1}'):/tmp/$(basename ${BACKUP})
  3. kubectl exec -it $(kubectl get pods | grep -e ^postgres | awk '{print $1}') -- /bin/bash -c "pg_restore --clean -U ps_user -f /tmp/$(basename ${BACKUP})"