mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
when kubectl exec fails to find the container to run a command, it should retry
Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
parent
4215fe57a5
commit
56719f83b7
@ -476,6 +476,12 @@ func kubectlExecWithRetry(namespace string, podName, containerName string, args
|
|||||||
Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes))
|
Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if strings.Contains(strings.ToLower(string(stdErrBytes)), "container not found") {
|
||||||
|
// Retry on "container not found" errors
|
||||||
|
Logf("Warning: kubectl exec encountered container not found.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes))
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stdOutBytes, stdErrBytes, err
|
return stdOutBytes, stdErrBytes, err
|
||||||
|
Loading…
Reference in New Issue
Block a user