skip to Main Content

I am a complete newbie to kubernetes and have set up my own cluster on-premises comprising of one master and two workers, using kubeadm, on some virtual machines.
I’d like to deploy a sample web application to get some experience working with docker and containers.

Now, once I finish using this sample application and am ready to set up something of use, is there a clean up involved?
How do I "uninstall" the previous software and remove the old containers/images and "install" a new application on the cluster?

I hope this is clear. I’m not entirely sure if what I’m asking is right so please do correct me. Thanks in advance!

I’ve only set up the cluster so far and couldn’t find anything online about "uninstalling" an app on a cluster. All I found was resources pointing to kubeadm reset.

2

Answers


  1. How do I "uninstall" the previous software and remove the old containers/images and "install" a new application on the cluster?

    How did you deploy the application in the first place? Typically, you do the reverse of whatever you did to deploy your manifests…

    • If you used kubectl apply -f <some_file> then to delete things you would run kubectl delete -f <some_file>

    • If you’re using kustomize (humble opinion: you should be), then instead of kubectl apply -k . you would kubectl delete -k ..

    • If you installed something using helm install, you would remove it with helm uninstall

    Etc.

    And of course, you could also delete the namespace into which your application was deployed, which will remove all resources in the namespace.

    Login or Signup to reply.
  2. In Kubernetes, kubeadm manages the infrastructure. Normally you don’t need to do any cleanup when you delete a static pod (With no replica) k8s delete it. However, in complex applications where you deploy replica sets, you also create persistent volumes and persistent volumes clams along with storage classes. You also create services and different namespaces. In the deployment case, most k8s delete their resources, but it is always nice to look and delete them manually if you don’t need them. Sometimes services and service accounts are not being deleted as they depend upon how you created them manually or as a stack of deployment.
    Use kubectl get all -A to view all the resources. All of your resources are either in the Default namespace or the namespace you created manually. Don’t delete anything from kube-system or another namespace you are not familiar.

    You can also use kubectl get all ns to list all the namespaces in your cluster. It will help to identify where you may have resources.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search