Skip to content

It's not possible to get logs during command construction #1731

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

Open
soltysh opened this issue Mar 28, 2025 · 3 comments · May be fixed by kubernetes/kubernetes#131290
Open

It's not possible to get logs during command construction #1731

soltysh opened this issue Mar 28, 2025 · 3 comments · May be fixed by kubernetes/kubernetes#131290
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@soltysh
Copy link
Contributor

soltysh commented Mar 28, 2025

What happened:
While preparing for KubeCon EU SIG CLI presentation I've wanted to show how users can see the logs when using kubectl preferences.
So I've run:

KUBECTL_KUBERC=true kubectl -v=5 get po -A

with an empty $HOME/.kube/kuberc file, hoping to see this message
https://github.com/kubernetes/kubernetes/blob/bdda0a530ed26fd5b9f389ae4333a748de861f32/staging/src/k8s.io/kubectl/pkg/kuberc/marshal.go#L99
but sadly I didn't get any. I started looking around and due to how we create commands we only initialize logging when running command.

What you expected to happen:
I'd like to see the output for all log messages even during command construction.

How to reproduce it (as minimally and precisely as possible):

KUBECTL_KUBERC=true kubectl -v=5 get po -A
@soltysh soltysh added the kind/bug Categorizes issue or PR as related to a bug. label Mar 28, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 28, 2025
@soltysh
Copy link
Contributor Author

soltysh commented Mar 28, 2025

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2025
@ardaguclu
Copy link
Member

/assign

@ardaguclu
Copy link
Member

I spent some time on this issue today. This is not specific to kuberc. For example, kubectl should be able to print a log in this line https://github.com/kubernetes/kubernetes/blob/990b02bf3952a14249fe74add831a5bb02576995/staging/src/k8s.io/kubectl/pkg/cmd/cmd.go#L534 but it doesn't.

I believe that after moving the log initialization into command executions (perhaps with this commit kubernetes/kubernetes@21d1bcd?), we lost the ability to printing logs during command preparation.

I tried to enable it but couldn't have achieved yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants