From the course: Certified Kubernetes Application Developer (CKAD) Cert Prep

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Finding pods

Finding pods

- All right, the next task is to find Pods. So the mission was to find all Pods that have the label tier=control-plane and write a list of these Pods to the file /tmp/task2pods. Let me show you what the solution is. So, let's use kubectl get pods minus A to look for pods in all namespaces, minus minus selector tier=control-plane. And there we have a couple of them. Now, we need to have all pods that have the label and we need to write the name of the pods to the file TMP task to pods. Now if you are comfortable with using Linux, then you can use some awking on that, and that's what I'm going to do. Otherwise, feel free to just write everything to /tmp/task2pods and clean it up manually because if you are not very comfortable with comments like this then you are going to lose too much time. But I'm going to use awk print dollar two and before writing it to the file, I want to make sure that this is showing what we want, and yeah, this is showing what we want. There's one line too many…

Contents