Skip to content

Kubernetes Pod Logs Feature Fails for Pods With > 1 Container

Summary

Kubernetes/GitLab environment pod log feature does not work for pods with more than one container.

Steps to reproduce

  1. Using an existing project with a working Kubernetes integration.
  2. Create a pod with > 1 container.
  3. View that environment's pod's logs.

Example Project

Unfortunately all of our org's projects are private.

What is the current bug behavior?

Viewing a pod with > 1 container fails with the red UI banner error: Something went wrong on our end (screenshot below). The controller API endpoint responds to the browser with 500 Internal Server Error.

What is the expected correct behavior?

Viewing a pod with > 1 container should work. Specifically:

  1. Describe the pod first to ascertain its containers and display the first element of the array/list of containers.
  2. The Pod logs from dropdown should list the containers in the current pod. Currently the dropdown contains the pod name which doesn't make sense to me given the current page/view is for a specific pod (the URL even has the pod name in the query string).

Relevant logs and/or screenshots

Screen_Shot_2019-07-12_at_3.17.05_PM

Output of checks

This bug happens on GitLab.com

Possible fixes

  1. Controller environments_controller.rb logs.json endpoint
  2. Calls platform kubernetes.rb read_pod_logs method without optional argument container which
  3. Calls kubeclient get_pod_log method
  4. Calls Kubernetes API log endpoint https://kubernetes/api/v1/namespaces/{namespace}/pods/{pod}/log?tailLines=500
  5. Which fails with 400 Bad Request
  6. Which controller environments_controller.rb responds with 500 Internal Server Error

🐢 s all the way down. 😆

Edited by Cameron Boulton