0
votes

I am trying to query a specific container's logs within a pod of several containers:

curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET ${APISERVER}/api/v1/namespaces/demo/pods/mypod-fgsardg4-dfsdf/log

How do I specify a particular container within this pod? I see that is part of the query via: https://kubernetes.io/docs/reference/kubernetes-api/workloads-resources/pod-v1/

But am not sure what it means by "in query".

This type of request fails:

curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET ${APISERVER}/api/v1/namespaces/demo/pods/mypod-fgsardg4-dfsdf/containername/log
1

1 Answers

2
votes

Figured it out:

GET /api/v1/namespaces/{namespace}/pods/{name}/log?container=test

Just didn't quite have the API syntax all the way there.