How can I execute a command with parameters though Kubernetes c# API method "WebSocketNamespacedPodExecAsync"?

From my machine I am able to execute the following command in powershell

kubectl --namespace myNameSpace exec myPodName cat myFileName.txt 

How can I execute the same command thought Kuberneres c#.NET method "WebSocketNamespacedPodExecAsync"

Also any reference on how to pass a command with parameters to "WebSocketNamespacedPodExecAsync" would be highly appreciated.

Add Comment
1 Answer(s)

I was able to do it as follows:

WebSocket webSocket = await client.WebSocketNamespacedPodExecAsync(myPodName, myNameSpave, new string[] { "cat", "composer.json" }); 

Reference: https://github.com/kubernetes-client/csharp/commit/d20e2597b9f41e8dcf8925bdd383d34d444f9d44

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.