I would like to collect the logs from one or more related pods using a labelSelector and the kubernetes HTTP API. However, I don't see any way to do this without first knowing all the pods names, e.g.
{{baseUrl}}/api/v1/namespaces/:namespace/pods/:name/log?container=cillum &follow=true&insecureSkipTLSVerifyBackend=true&limitBytes=-94468552&pretty=cillum &previous=true&sinceSeconds=-94468552&tailLines=-94468552×tamps=true
Is this possible, or should I mount a container with kubectl
and use that to get the logs I want?
I can get the logs using kubectl
like so:
kubectl logs -l job=myjob -n test -c main
I would assume there is a similar way to retrieve logs using the labelSelector
using the API.