0

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
  • 75
  • 8
  • "Stop" isn't a valid verb for pods; you need to delete the pod (or set its controlling deployment to 0 replicas). [how to stop/pause a pod in kubernetes](https://stackoverflow.com/questions/54821044/how-to-stop-pause-a-pod-in-kubernetes) has the CLI equivalent. – David Maze Nov 22 '20 at 12:13
  • @David Mazeok so if i want to set its controlling deployment to 0 how i do it with c# code? – liran Nov 22 '20 at 13:21

0 Answers0