Kubernetes: Mount the pod filesystem with SSHFS?

Viewed 16

Is it possible to mount a Kubernetes pod via SSHFS?

I have a running pod with interpreted scripts, and I would like to edit these scripts live within the pod, but in IntelliJ IDEA.

I know I can do kubernetes exec ... /bin/bash, but that's not the same as ssh and can't be leveraged by sshfs (as far as I know).

I know I can install OpenSSH and use ssh within the cluster or from the host, but this is an Azure AKS environment so that's not applicable.

Or is there any other FUSE filesystem which allows mounting a pod through what Kubernetes provides?

1 Answers

Is it possible to mount a Kubernetes pod via SSHFS?

No.

If you look at the API documentation for Pods, for example, its operations include basic CRUD operations on the Pod spec; some sub-objects like the Pod status and ephemeral containers; a more opaque API around port-forwarding; and an HTTP GET call to read back logs; but none of those give direct access to the container filesystem. This would in principle depend some on the container runtime as well, but you also can't get direct access to the container filesystem on plain Docker, even using Docker's APIs.

I have a running pod ... and I would like to edit [its code] live

This sounds like you're looking for a day-to-day development setup. Kubernetes a multi-node remote clustered container setup with code stored in immutable images. You might try running your setup in a non-clustered container environment like plain Docker, or even skipping containers altogether so that there's no layers of indirection between your IDE and the interpreter.

Related