Kubernetes – Kubectl Delete
Last Updated :
30 Mar, 2023
Pre-requisite: Kubernetes
Kubernetes is an open-source Container Management tool that automates container deployment, container scaling, descaling, and container load balancing (also called a container orchestration tool). It is written in Golang and has a huge community because it was first developed by Google and later donated to CNCF (Cloud Native Computing Foundation). kubectl delete is used to delete resources by using a configuration file or by using the type of resource and the resource name.
kubectl delete ([-f FILENAME] | TYPE [(NAME | --all)])
Example: Suppose we are having Nginx web server deployment and Service running.
Deleting Deployment:
$ kubectl delete deployment deployment_name
Alternatively, you can also point your terminal to the file containing the deployment config file and use the command
$ kubectl delete -f your_config_file.yaml
Deleting Service:
$ kubectl delete service service_name
Alternatively, you can also point your terminal to the file containing the deployment config file and use the command
$ kubectl delete -f your_config_file.yaml
Deleting All Resources:
$ kubectl delete resource_type -all
Examples:
$ kubectl delete deployment -all
$ kubectl delete service --all
Share your thoughts in the comments
Please Login to comment...