title: How to forward psql shell from kubectl
body: <p>I'm trying to make my life easier and am coding a bash script. One of these allows me to kube into a pod with postgres access, get the credentials I need, and run the interactive psql shell. </p>
  
  <p>However, upon running</p>
  
  <pre><code>kubectl &lt;flags&gt; exec $podname -- bash -c ' get_credentials &amp;&amp; psql &lt;psql args&gt; -i -t
  </code></pre>
  
  <p>the terminal hangs. </p>
  
  <p>I can't directly connect to the database, and the process to get the credentials is kinda cumbersome. Is there some bash concept I'm not understanding?</p>