InseeFrLab / onyxia

🔬 Data science environment for k8s
https://onyxia.sh
MIT License
432 stars 78 forks source link

Streaming events for pod with container not initialized #826

Open nitreb opened 3 weeks ago

nitreb commented 3 weeks ago

Hi,

We have trouble getting logs from the api/my-lab/app/logs endpoint, where the targeted pod has multiple containers, and one of them is not yet initialized. We get a error 500 and the onyxia API pod logs:

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://10.254.0.1:443/api/v1/namespaces/user-XXX/pods/marine-plastic-exposure-257003-wh2zv/log?pretty=false. Message: container "copy-output" in pod "marine-plastic-exposure-257003-wh2zv" is waiting to start: PodInitializing. Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=container "copy-output" in pod "marine-plastic-exposure-257003-wh2zv" is waiting to start: PodInitializing, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).

It is understandable as the kubectl logs my_pod command requires to specify a container if my_pod has more than one, or you can also use the --all-containers flag. I tried to look into the fabric8's getLog() method but Java is not my specialty so I have no fix to propose.

Also, please note that it would be very useful for us to have access to every log available even if some containers are not yet initialized.

Thanks in advance!

fcomte commented 3 weeks ago

Hello we are already working on the api to better handle :