Kubernetes - how to tear down cluster?

12/11/2016

I've been trying to shut down kubernetes cluster , but I couldn't managed to do it.

When I type

kubectl cluster-info

I can see that my cluster is still running.

I tried commands like running script

kube-down.sh

but it didn't work.

I deleted all pods. How can I shut it down ?

-- Mont
kubernetes

3 Answers

1/26/2017

When using kube-down.sh you've to make sure that all the environment variables which were adjusted for the kube-up.sh are also used during the shut down. See also

-- pagid
Source: StackOverflow

12/19/2017

The tear down section of the official documentation says:

To undo what kubeadm did, you should first drain the node and make sure that the node is empty before shutting it down.

Talking to the master with the appropriate credentials, run:

kubectl drain <node name> --delete-local-data --force --ignore-daemonsets 
kubectl delete node <node name>

Then, on the node being removed, reset all kubeadm installed state:

kubeadm reset
-- sajjadG
Source: StackOverflow

12/12/2016

You cannot use kubectl stop command as it has been deprecated. If you have created pods using a yaml file, I suggest you use kubectl delete -f <filename>.yml to stop any running pod.

You can also delete service associated with running pods by using the following command:

# Delete pods and services with same names "baz" and "foo"
kubectl delete pod,service baz foo
-- aftab kotwal
Source: StackOverflow