serving icon indicating copy to clipboard operation
serving copied to clipboard

Set k8s default container label

Open dprotaso opened this issue 1 year ago • 3 comments
trafficstars

TIL I learned about kubectl.kubernetes.io/default-container

https://kubernetes.io/docs/reference/labels-annotations-taints/#kubectl-kubernetes-io-default-container

The value of the annotation is the container name that is default for this Pod. For example, kubectl logs or kubectl exec without -c or --container flag will use this default container.

We should make the main/serving container the 'default' container for these purposes. When we create the deployment we can add this as a label onto the pod.

/good-first-issue

dprotaso avatar Jul 11 '24 15:07 dprotaso

@dprotaso: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

TIL I learned about kubectl.kubernetes.io/default-container

https://kubernetes.io/docs/reference/labels-annotations-taints/#kubectl-kubernetes-io-default-container

The value of the annotation is the container name that is default for this Pod. For example, kubectl logs or kubectl exec without -c or --container flag will use this default container.

We should make the main/serving container the 'default' container for these purposes

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

knative-prow[bot] avatar Jul 11 '24 15:07 knative-prow[bot]

Happy to work on it

jasonsmithio avatar Jul 27 '24 04:07 jasonsmithio

/assign @jasonsmithio

dprotaso avatar Jul 28 '24 17:07 dprotaso

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Oct 27 '24 01:10 github-actions[bot]

/remove-lifecycle stale

skonto avatar Nov 01 '24 13:11 skonto

@jasonsmithio hi, are you still working on this one?

skonto avatar Nov 01 '24 13:11 skonto

Howdy,

Apologies, I completely forgot. Let me work on this and get it done before EOM.

jasonsmithio avatar Nov 05 '24 00:11 jasonsmithio

Hi , @jasonsmithio is this issue being worked on? If not, i would love to take this.

KapilSareen avatar Dec 13 '24 20:12 KapilSareen

@KapilSareen Go for it. I have been a bit backlogged on stuff and haven't been able to look at it. A great first issue so recommend it!

jasonsmithio avatar Dec 13 '24 20:12 jasonsmithio

/assign

KapilSareen avatar Dec 13 '24 20:12 KapilSareen

Hey @dprotaso @skonto , sorry for the basic question, but could you clarify or provide an example command that should be run after the requested change?

I'm a bit confused about whether you want to achieve this:

  • kubectl logs -n my-namespace to get logs from the controller container

Or:

  • kubectl logs -n mynamespace -p mycontainerpodname to retrieve logs from a specific pod?

I assume you meant the first option, since the second one seems unnecessary given that most pods have a single container. Let me know if I'm wrong!

KapilSareen avatar Dec 13 '24 22:12 KapilSareen

Hey @dprotaso , any updates?

KapilSareen avatar Dec 31 '24 16:12 KapilSareen

Hey @KapilSareen, would you mind if I take this issue? I'd have a PR ready. Thanks!

konstfish avatar Jan 14 '25 01:01 konstfish

@KapilSareen there are more details in this KEP about how the feature works in K8s https://github.com/kubernetes/enhancements/blob/master/keps/sig-cli/2227-kubectl-default-container/README.md

@konstfish please try to avoid duplicate work by not picking up issues others are working on. Pairing is fine if you reach out to @KapilSareen and work on it together

dprotaso avatar Jan 14 '25 01:01 dprotaso

Right sorry, I thought this Issue had gone stale & it's something I encountered earlier today. My progress is at https://github.com/knative/serving/compare/main...konstfish:serving:main if you could take a quick look over @KapilSareen

konstfish avatar Jan 14 '25 01:01 konstfish

@konstfish I've reviewed your progress, and I think you're ready to open a PR. My progress is minimal so far.

KapilSareen avatar Jan 14 '25 08:01 KapilSareen

Awesome, thanks! I'll add you as a contributor on my fork as well, there's most likely still some work to do on the tests/gating this feature behind a config.

/assign

konstfish avatar Jan 14 '25 13:01 konstfish

Awesome, thanks! I'll add you as a contributor on my fork as well, there's most likely still some work to do on the tests/gating this feature behind a config.

Sounds great! Let me know if there's anything I can do to help. Let's move this to Slack. Can you ping me there, and we can plan things out.

KapilSareen avatar Jan 14 '25 13:01 KapilSareen