I am trying to get the list of files in a pod directory using this code this
Code I tried:
import io.kubernetes.client.Exec;
..........
Exec exec = new Exec();
boolean tty = System.console() != null;
String[] command = {"/bin/sh","-c", "ls", "/var/log"};
final Process proc =
exec.exec(namespace, podName, command , false, tty);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
proc.waitFor();
in.close();
but this always output "data", instead of the files in the dir. How can i make it work. If. i try this using kubectl command line this works.