Create a file:
/opt/KUCC00302/kucc00302.txt that lists all pods that implement service baz in namespace development.
The format of the file should be one pod name per line.
Suggested Answer: A
Get Premium CKA Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
27 comments · newest first
RO
Rosalia
10 months ago
Yeah, but don't forget to check the labels!
LO
Louvenia
11 months ago
Wait, does that actually work for all namespaces?
MA
Mari
11 months ago
Just use `kubectl get pods -n development -l app=baz` to list them.
GE
Georgeanna
11 months ago
I thought we needed to specify the service name too?
LY
Lynsey
11 months ago
Totally agree, that's the easiest way!
JU
Juliann
11 months ago
I think we might need to use `kubectl get pods --selector` to filter by the service, but I can't recall the exact syntax.
CH
Charolette
12 months ago
I feel a bit lost on how to specify the namespace in the command. Is it `-n development` or something else?
JU
Jutta
12 months ago
I remember practicing a similar question where we had to list deployments. I think we might need to use `-o name` or something like that to get just the pod names.
AU
Augustine
1 year ago
I think we need to use `kubectl get pods` with some flags to filter by the service, but I'm not entirely sure how to format the output.
LI
Linette
1 year ago
This is a good opportunity to practice my Kubernetes skills. I'll take it step-by-step and make sure I get the file created correctly.
LI
Linn
1 year ago
Wait, do I need to use `kubectl` or can I just use standard Linux commands to create the file? I'm a bit confused about the requirements here.
RE
Reynalda
1 year ago
Okay, I think I've got this. I'll use `kubectl get pods -n development --selector=app=baz` to list the pods, then redirect the output to the file at the specified path.
HA
Harrison
1 year ago
Hmm, I'm not sure how to create that file in the specified location. I'll need to look up the commands for that.
WA
Walker
1 year ago
This looks straightforward. I'll start by checking the pods in the development namespace and filtering for the ones that implement the baz service.
JE
Jettie
1 year ago
Haha, this reminds me of that time I accidentally deleted the entire 'development' namespace. Not making that mistake again!
KR
Kristin
1 year ago
Ah, I see. So we need to create a file with the list of pods that implement the 'baz' service in the 'development' namespace. Sounds good, I'm on it!
AN
Antonio
1 year ago
I'll make sure to list all pods implementing service baz in namespace development.
ET
Ettie
1 year ago
Remember, one pod name per line in the file.
BE
Beatriz
1 year ago
Got it! Let's create that file with the pod names.
AL
Alaine
1 year ago
That's a good idea. We can then redirect the output to a file in the specified format.
TA
Tamra
1 year ago
Yes, we can use the kubectl command to get the pods and then filter by service.
AL
Alaine
1 year ago
I think we need to create a file listing pods implementing service baz in namespace development.
JO
Jolanda
1 year ago
This seems pretty straightforward. I'd use the `kubectl get pods -n development --selector=app=baz -o name` command to get the list of pod names and then write them to the file.
JU
Juliana
1 year ago
After creating the file, you can verify its contents with `cat /opt/KUCC00302/kucc00302.txt`.
MA
Marva
1 year ago
Don't forget to specify the full path to the file when redirecting the output.
WI
Wilbert
1 year ago
You can also use the `awk` command to extract just the pod names from the output.
ST
Stefan
1 year ago
That's a good approach. Make sure to redirect the output to the file using `>`.