1

I'm trying to install the nfs-common package via apt-get on a Kubernetes node. To achieve this I created a privileged pod and then accessed it with this command: kubectl exec -ti privileged-pod sh

Once I'm inside the container shell I execute this command to access the node:

chroot /host/

Here is where I should be able to use the following: apt-get install -y nfs-common

But I get the following error:

/bin/sh: apt-get: not found

I tried to download apt with wget, but dpkg is not available either:

/bin/sh: dpkg: not found

How could I install the package?

Docker for Mac version: v19.03.8

Kubernetes version: v1.15.5

Kubernetes Node OS: Linux 4.19.76-linuxkit x86_64

Using docker-desktop node

3
  • The OS you posted, "Linux 4.19.76-linuxkit x86_64" is too broad to determine which flavor of user space (CentOS or Debian or something else) your nodes are running. Check if there is any output from cat /etc/*release, that should indicate which user space flavor you are running. You may have another package manager installed such as yum or dnf. Apr 28, 2020 at 18:28
  • @GracefulRestart the output for cat /etc/*release is PRETTY_NAME="Docker Desktop"
    – Ian Spitz
    Apr 28, 2020 at 20:27
  • 1
    I don't think you're going to be able to install software in the vm that Docker Desktop is setting up for you. Even if you could, I doubt the kernel in that environment would support NFS. What are you trying to accomplish? Do you want a pod to be able to mount an NFS volume? May 26, 2020 at 3:57

1 Answer 1

-1

Don't install packages on running containers. Never ever. That's not how it is supposed to work.

Even more generally, if you need to log in into a particular node on Kubernetes to do anything, you are doing it wrong.

If you do need NFS, make sure to use a Docker image that has it already installed, or install it using a Dockerfile to make your own image.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .