Skip to content

Make it possible to shell into any container, even if it has no shell #10834

Closed

Description

@thockin

Today kubectl exec sh depends on a shell being present in each container image. I think we can do better.

What if we had something like kubectl sh which would run a statically linked busybox (or something like that) that was provided by the host node and made that enter the cgroups and namespaces and chroot of the container? We already have a short list of features that only work if the host node has some piece of software installed, this would be the same.

Activity

  1. added
    sig/nodeCategorizes an issue or PR as relevant to SIG Node.
    sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.
    on Jul 7, 2015
  2. added this to the milestone on Jul 7, 2015
  3. removed this from the milestone on Jul 24, 2015
  4. smarterclayton commented on Aug 4, 2015

    @smarterclayton
    Contributor

    @ncdc

    yes I've hit this several times. We added oc rsh that provides a helper for -itp -- bash but a more generic static linking solution would be good that works on any container

    It can't totally depend on busybox (has to be replaceable/configurable) because we can't ship/support busybox.

    Probably bonus points for allowing this to be more sophisticated down the road and inject other things (statically linked ssh)

  5. luxas commented on Jan 4, 2017

    @luxas
    Member

    Is this something we can prioritize?
    The actual implementation, what would it look like?
    A flag to the kubelet, sigh, that let's the user choose shell intepreter on host (default /bin/sh, since it exists nearly everywhere) and when the user is running kubectl sh it would just run nsenter, but with sh from the host, right?

    cc @timstclair

    Anyone up for this?

  6. smarterclayton commented on Jan 4, 2017

    @smarterclayton
    Contributor

    I don't think we'd want to override the image's shell, it would have to be a fallback iff the shell is missing.

  7. verb commented on Jan 4, 2017

    @verb
    Contributor

    @luxas I have this problem as well, see #35584 for how I'd like to address it. I'm looking for additional use cases, so your input would be most welcome.

    This isn't a priority for SIG Node (at least as defined in the tentative 2017Q1 road map), but it's the only thing I'm attempting to contribute so it's a priority for me.

  8. thockin commented on Jan 5, 2017

    @thockin
    MemberAuthor
  9. smarterclayton commented on Jan 5, 2017

    @smarterclayton
    Contributor

    Let me clarify - it is unacceptable for exec to change to magically override the built in shell, because that is not backwards compatible and breaks large classes of apps on Kube. It's acceptable to make static injection a net new mechanism, and might be acceptable to fallback.

    I also don't want a generic shell command that is tied too closely with one particular shell impl - we would not be able to ship that for lots of reasons, most of which include support. So I'm -1 to a "special" exec command that uses a shell binary we ship always.

  10. thockin commented on Jan 5, 2017

    @thockin
    MemberAuthor
  11. verb commented on Jan 5, 2017

    @verb
    Contributor

    It's a requirement for the runtimes rather than the kubelet, and the CRI will need to add support. It's the run times that would have to ship a binary. Implementation would be pretty straightforward for the current container-based runtimes and slightly more difficult for hypervisor/cloud runtimes.

    This solution is constrained to a single static binary specified by the Kubernetes developers, limiting its usefulness. I'd much prefer to be able to use an arbitrary container image for debugging, but the two aren't mutually exclusive.

  12. smarterclayton commented on Jan 5, 2017

    @smarterclayton
    Contributor
  13. thockin commented on Jan 5, 2017

    @thockin
    MemberAuthor
  14. 38 remaining items

  15. removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jan 15, 2019
  16. fejta-bot commented on Apr 15, 2019

    @fejta-bot

    Issues go stale after 90d of inactivity.
    Mark the issue as fresh with /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle stale

  17. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Apr 15, 2019
  18. zanetworker commented on May 12, 2019

    @zanetworker
    Contributor

    /remove-lifecycle stale

  19. removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on May 12, 2019
  20. fejta-bot commented on Aug 10, 2019

    @fejta-bot

    Issues go stale after 90d of inactivity.
    Mark the issue as fresh with /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle stale

  21. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Aug 10, 2019
  22. verb commented on Aug 13, 2019

    @verb
    Contributor

    /remove-lifecycle stale

  23. removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Aug 13, 2019
  24. tallclair commented on Aug 13, 2019

    @tallclair
    Member

    /lifecycle frozen

  25. added
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.
    on Aug 13, 2019
  26. verb commented on Aug 27, 2019

    @verb
    Contributor

    With #59484 merged, this has become "possible". We still have a way to go to make it useful out of the box and to graduate the feature. I'm going to close this issue because we have a few others tracking this.

    If you're interested in following along, keep an eye on issue #27140 and kubernetes/enhancements#277.

    /close

  27. k8s-ci-robot commented on Aug 27, 2019

    @k8s-ci-robot
    Contributor

    @verb: Closing this issue.

    Details

    In response to this:

    With #59484 merged, this has become "possible". We still have a way to go to make it useful out of the box and to graduate the feature. I'm going to close this issue because we have a few others tracking this.

    If you're interested in following along, keep an eye on issue #27140 and kubernetes/enhancements#277.

    /close

    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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/backlogHigher priority than priority/awaiting-more-evidence.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.sig/nodeCategorizes an issue or PR as relevant to SIG Node.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions