Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

301
Visualizações
How to list really all objects of a nonexistant namespace?

Okay, the title is quite mouthful. But it's actually describing the situation.

I deployed a service on GKE in namespace argo-events. Something was wrong with it so I tore it down:

kubectl delete namespace argo-events

Actually, that's already where the problems started (I suspect a connection to the problem described below) and I had to resort to a hack because argo-events got stuck in a Terminating state forever. But the result was as desired - namespace seemed to be gone together with all objects in it.

Because of problems with redeployment I inspected the GKE Object Browser (just looking around - cannot filter for argo-events namespace anymore as it is officially gone) where I stumbled upon two lingering objects in ns argo-events:

enter image description here

argo-events is not listed by kubectl get namespaces. Just confirming that.

And I can find those two objects if I look them up specifically:

$ kubectl get eventbus -n argo-events
NAME      AGE
default   17h

$ kubectl get eventsource -n argo-events
NAME                  AGE
pubsub-event-source   14h

But - I cannot find anything by asking for all objects:

$ kubectl get all -n argo-events
No resources found in argo-events namespace.

So my question is. How can I generically list all lingering objects in argo-events?

I'm asking because otherwise I'd have to inspect the entire Object Browser Tree to maybe find more objects (as I cannot select the namespace anymore).

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

By using command $ kubectl get all you will only print a few resources like:

  • pod
  • service
  • daemonset
  • deployment
  • replicaset
  • statefulset
  • job
  • cronjobs

It won't print all resources which can be found when you will use $ kubectl api-resources.

Example

When create PV from PersistentVolume documentation it won't be listed in $ kubectl get all output, but it will be listed if you will specify this resource.

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/storage/pv-volume.yaml
persistentvolume/task-pv-volume created
$ kubectl get pv
NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE
task-pv-volume   10Gi       RWO            Retain           Available           manual                  3m12s
$ kubectl get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.3.240.1   <none>        443/TCP   86m
$ 

If you would like to list all resources from specific namespace you should use command below:

kubectl -n argo-events api-resources --namespaced=true -o name | xargs --verbose -I {} kubectl -n argo-events get {} --show-kind --ignore-not-found

Above solution was presented in Github thread kubectl get all does not list all resources in a namespace. In this thread you might find some additional variations of above command.

In addition, you can also check How to List all Resources in a Kubernetes Namespace article. You can find there method to list resources using function.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda