Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log analyzer failed with multiple containers in the pod #884

Closed
2 of 4 tasks
lili-wan opened this issue Jan 23, 2024 · 2 comments · Fixed by #920
Closed
2 of 4 tasks

Log analyzer failed with multiple containers in the pod #884

lili-wan opened this issue Jan 23, 2024 · 2 comments · Fixed by #920

Comments

@lili-wan
Copy link
Contributor

lili-wan commented Jan 23, 2024

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

Latest

Kubernetes Version

No response

Host OS and its Version

No response

Steps to reproduce

  1. Run 'k8sgpt analyze --filter Log --namespace ' that has a pod running with multiple containers
  2. You will get the following error
- Error: Error the server rejected our request for an unknown reason (get pods efs-csi-node-us-west-2b-n7dwf) from Pod efs-csi-node-us-west-2b-n7dwf

Expected behaviour

The Log filter should scan all the containers and return the error logs if there is any

Actual behaviour

The Log filter returns a server error

Additional Information

No response

@VaibhavMalik4187
Copy link
Contributor

@AlexsJones, I was going through the log analyzer when I noticed that the following line of code would fetch all the pods(running and stopped) in a given namespace.

list, err := a.Client.GetClient().CoreV1().Pods(a.Namespace).List(a.Context, metav1.ListOptions{})

However, the comment states that it only fetches pods that are not running. Is this intentional?

// search all namespaces for pods that are not running

@lili-wan
Copy link
Contributor Author

lili-wan commented Feb 6, 2024

I think the comment is not correct, it does fetch logs from all the pods, but the issue is if the pod has multiple containers, it will return error because it does not fetch the log from individual container

AlexsJones added a commit that referenced this issue Feb 21, 2024
* Log analyzer failed with multiple containers in the pod #884

Signed-off-by: lwan3 <lili_wan@intuit.com>

* Merge conflicts from main

Signed-off-by: lwan3 <lili_wan@intuit.com>

---------

Signed-off-by: lwan3 <lili_wan@intuit.com>
Co-authored-by: lwan3 <lili_wan@intuit.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants