Skip to content

sudo -i support within ssh command #108

@gberche-orange

Description

@gberche-orange

Thanks for sharing your work within the community !

We're running kubernetes k3s disto on top of nodes managed by cloudfoundry bosh infrastructure, see https://bosh.io/ and https://github.com/orange-cloudfoundry/k3s-wrapper-boshrelease for more background.

In our environment, the kubernetes nodes are reached by ssh using a guest user which has sudo/su permissions, but whose account is not configured for user interaction (e.g with crictl in path)

server/11aa3763-7a95-47ad-8089-7399a97a2d0d:~/test# ./kubectl-nsenter --use-node-name=false --user guest -n kube-system coredns-66f786f4cb-ghcvk /coredns 
time="2025-07-10T10:07:06Z" level=fatal msg="cannot access containerd socket \"/run/containerd/containerd.sock\": no such file or directory"
nsenter: failed to parse pid: '/coredns'
./kubectl-nsenter: failed to execute ssh command: failed to run child process "ssh": exit status 1server/11aa3763-7a95-47ad-8089-7399a97a2d0d:~/

exec crictl inspect --output go-template --template={{.info.pid}} %[1]s;

In our environment, the following sequence succeeds

ssh guest@192.168.116.224
sudo -i
crictl inspect --output go-template --template={{.info.pid}} 028df9c85f9db;
218035

Would it make sense to support such environments, by adding the possibly to sudo -i prior to run the discovery commands ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions