ahmetb / kubectl-tree

kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: List all containers (if --containers flag given)

Dentrax opened this issue · comments

It would be great to list all containers for each Pod if --containers flag passed. Couldn't find a similar issue, so dropping this idea.

$ kubectl tree deployment foo

NAMESPACE  NAME                          READY  REASON  AGE
aa         Deployment/foo                -              21h
aa         └─ReplicaSet/foo-6f67dcc579   -              10m
aa           └─Pod/foo-6f67dcc579-znb55  True           10m

But we probably have to include a new column called RUNNING if aforementioned flag passed. (Not so sure about this) Like the following:

$ kubectl tree deployment foo --containers

NAMESPACE  NAME                              READY  RUNNING  REASON  AGE
aa         Deployment/foo                    -      -                21h
aa         └─ReplicaSet/foo-6f67dcc579       -      -                10m
aa           └─Pod/foo-6f67dcc579-znb55      True   -                10m
aa             └─Container/first-container   -      True
aa             └─Container/second-container  -      True

I've tried to pass pods into KIND to check whether it works:

$ kubectl tree pods foo-6f67dcc579-znb55
Error: ambiguous kind "pods". use one of these as the KIND disambiguate: [pods.v1., pods.v1beta1.metrics.k8s.io]

$ kubectl tree pods.v1 foo-6f67dcc579-znb55
Error: could not find api kind "pods.v1"

$ k api-resources | grep "pod"
pods                           po        v1                      true         Pod

But no luck. So decided to file an issue for further discussing. Thoughts?

cc @anilmisirlioglu @Abdulsametileri

Are containers api objects? I don’t think so. So that might be why they do not show up. This tool works on objects in a generic way. This request might be more appropriate for a contextual plugin like “lineage”.