Repository navigation
Replies: 1 comment
|
Thanks for the write-up, agreed with a narrower scope! Two corrections on the current state first:
Agreed scope:
Out of scope for now:
Once the bug fix lands, feel free to open an issue for the rest linking this discussion and go for it :) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What problem are you trying to solve?
Pods with sidecars (Istio, log shippers, proxies) have one container I actually care about. Kubernetes has a standard way to say which one: the
kubectl.kubernetes.io/default-containerannotation (KEP-2227, stable since v1.27). kubectl uses it forlogs,exec,attachandcp. Istio's injector sets it, and so do other operators and manifests.sofka applies it inconsistently:
kubectlwithout-c. sofka doesn't know which container it opened, so prompts and titles can't name it.l) stream every container, so sidecar output is mixed in.p) and the bundle's log section use the first container in the spec, which is often not the annotated one.Proposed solution
Resolve the default container in one place and use it for every action that works on a single container. Resolution order: the annotation (only if it names a container in
spec.containers), then the only container if there is just one, then today's behavior.l), on pods and on workloads through their pod template: stream the default container. A key (k9s usesa) toggles to all containers.p) and bundle logs: use the default container instead of the first one.-c <default>explicitly so behavior doesn't depend on the kubectl version, and show the container in the title or prompt (for exampleDownload from pod:app).:debugfrom a pod row: prefill--targetwith the default container. This is optional; kubectl doesn't do it automatically.k9s references:
dao/helpers.go#GetDefaultContainerview/logs_extender.go#podLogOptionsview/pod.go#containerShellIn/fetchContainersdao/log_options.go#ToggleAllContainersAlternatives considered
[istio-proxy]in the logs view. That only hides lines, the sidecar is still streamed, and it's specific to Istio.All reactions