Open
Description
java.net.ProtocolException: Expected HTTP 101 response but was '500 Internal Server Error'
I am trying to execute a script in each pod of my namespace.
public void checkPods()
{
try
{
V1PodList podList = api.listNamespacedPod(this.namespace).execute();
int threshold = 80;
String[] cmd = {"bash", "-c", "exec df -h | awk '$5 > " + threshold + " {print}' 2>/dev/null"};
for (V1Pod pod : podList.getItems()) {
String podName = pod.getMetadata().getName();
Exec exec = new Exec(this.apiClient);
Process p = exec.exec(pod, cmd, true);
}
}
catch (ApiException | IOException e) {
throw new RuntimeException("Error executing command in pods", e);
}
}
The above code is always giving the correct output but not without this error being thrown multiple times first. How to solve this error?