Home > Enterprise >  How to delete ingress from default namespace
How to delete ingress from default namespace

Time:10-04

How to delete below given ingress from default namespace?

# kubectl get ingress
Warning: extensions/v1beta1 Ingress is deprecated in v1.14 , unavailable in v1.22 ; use networking.k8s.io/v1 Ingress
NAME              CLASS    HOSTS             ADDRESS      PORTS   AGE
abc-ingress       <none>   app.company.com                80      24h
kubectl describe ingress jenkins-ingress
Warning: extensions/v1beta1 Ingress is deprecated in v1.14 , unavailable in v1.22 ; use networking.k8s.io/v1 Ingress
Name:             abc-ingress
Namespace:        default
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host             Path  Backends
  ----             ----  --------
  abc.company.com
                   /   app-svc:80 (<error: endpoints "app-svc" not found>)
Annotations:       <none>
Events:            <none>

Tried to delete using below command, But it doesn't work.Please suggest to delete it.

# kubectl delete abc-ingress -n default
error: the server doesn't have a resource type "abc-ingress"

CodePudding user response:

While Ali Rezvani's answer is correct, I'd like to extend upon it.

kubectl commands are structured as follows:

kubectl ACTION RESOURCE NAME [ -n NAMEPACE ]

Where ACTION can be get, delete, describe, etc.

RESOURCE can be deployments, service, pods, ingress or one of its short forms: deploy, svc, po, or ing

NAME is the name of the resource(s) you want to apply the ACTION on.

So if you wanted to delete the ingress named abc-ingress in the namespace default, you would use:

kubectl delete ingress abc-ingress -n default

(side note: generally, normally you can omit -n default as the default namespace is normally, as the name suggests, the default namespace)

CodePudding user response:

If your default namespace for your user defined default in your kube config you can use:

kubectl delete ingress abc-ingress

but if your default namespace in diffrent, you should pass namespace name:

kubectl delete ingress abc-ingress -n default

CodePudding user response:

The below command helped to delete ingress from default namespace.

kubectl delete --all ingress
ingress.extensions "abc-ingress" deleted
  • Related