How do i list pods based on labels using kubernetes cli?



  • This assumes you know what the label of your pods is. After deploying many apps, requires that proper labels are associated with your pods defining what they do, this will help in managing kubernetes.

     -L, --label-columns=[]: Accepts a comma separated list of labels that are
    going to be presented as columns. Names are case-sensitive. You can also use
    multiple flag options like -L label1 -L label2...
    

    Also see help page for kubectl get: https://www.lightnetics.com/post/10279
    List all pods that have the label "k8s-app"

    kubectl get pods -L k8s-app
    

Log in to reply
 

© Lightnetics 2024