Kubernetes C# Client - stop and start pod or restart pod

11/22/2020

i used with kubernetes client and i want to stop and start one pod that i found in my code, for example:

            var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(path);
            var client = new Kubernetes(config);    
            ...    
            var list = client.ListNamespacedPod(nameSpace);   
            var currentPod = list.Items.FirstOrDefault(...); 
            
            // what to do here? i need something like that:
            // currentPod.Stop();
            // currentPod.Start();
            // or currentPod.Restart(); 
            // or scale to 0 and after scale to 1

i searching here: https://github.com/kubernetes-client/csharp but i don't found the solution. any ideas?

thanks!

-- liran
kubernetes

0 Answers