Closed
Description
Describe the bug
Running a command in a pod works, but it never returns. In the code below we never see "after exec". I saw another similar ticket, but that was resolved so not sure if its relevant: #1267
Kubernetes C# SDK Client Version
e.g. 11.0.44
Server Kubernetes Version
e.g. 1.25.9
Dotnet Runtime Version
e.g. net7
To Reproduce
var cmds = new List<string>();
cmds.Add("pwd");
Console.WriteLine("before exec");
await kubeclient.NamespacedPodExecAsync(
"<pod_name_we_want_to_run_command_in>", "<namespace_where_pod_is>", "<container_in_pod>", cmds, false, CallbackHandle, Globals.cancellationToken);
Console.WriteLine("after exec");
return null;
}
public static Task CallbackHandle(Stream stdIn, Stream stdOut, Stream stdErr)
{
StreamReader sr = new StreamReader(stdOut);
while (!sr.EndOfStream)
{
Console.WriteLine(sr.ReadLine());
}
return null;
}
Expected behavior
I expect the command to execute in the pod and then return, allowing the program to continue, but it seems the await on the Exec never returns.
Where do you run your app with Kubernetes SDK (please complete the following information):
- OS: [e.g. Linux]
linux, redhat9 - Environment [e.g. container]
container - Cloud [e.g. Azure]
onprem, kubeadm
Additional context
I tried removing code from the CallbackHandle, to instead just 'return null', in case that might help, but it didn't seem to.
Metadata
Metadata
Assignees
Labels
No labels