Deleting a Service

If you go through every command in this section, there are definitely some demonstrated Kubernetes Services (we counted six of them) that should be removed. To delete a Service, the same as with any other Kubernetes resource, you can remove the Service with the name or the configuration file through the subcommand delete. When you try to remove the Service and the Endpoint at the same time, the following situation will happen:

// the resource abbreviation of endpoint is "ep", separate different resource types by comma
$ kubectl delete svc,ep k8s-ep
service "k8s-ep" deleted
Error from server (NotFound): endpoints "k8s-ep" not found

This is because a Service is also a Kubernetes Endpoint. That's why, although we created the Service and the endpoint separately, once they are considered to work as a unit, the Endpoint is going to be removed when the Service is removed. Thus, the error message expresses that there is no endpoint called k8s-ep, since it was already removed with the Service deletion.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.249.198