I'm trying to execute psql commands using exec kubernetes java client API, for example:
final Process proc = exec.exec(pod, new String []{"sh", "-c", "su postgres -c 'psql -c 'SELECT schema_name FROM information_schema.schemata';'"} , true, true);
for some reason I get no results as output, it just prints this:
--
(1 row)
Even though when I simply use kubectl exec directly the SELECT commands return the results correctly.
Is there something I'm missing? Any help would be appreciated.