kuberneteskubectlbitnami

bitnami/kubectl container unable to create files - permission denied


I have used "bitnami/kubectl:latest" image to my test container which runs inside a test pod. I just login to that container and I wanted to create a file inside that container. But ended up with below error.

I have no name!@test:/$ touch test
touch: cannot touch 'test': Permission denied
I have no name!@test:/$ mkdir test
mkdir: cannot create directory 'test': Permission denied

Can someone help me to understand why this problem occurs and how to fix this? I am aware that mounting the file as configmap might help me but just I need to understand this issue. Thanks in advance!


Solution

  • The issue here is that the docker image which you are using is configured to run its final instruction using a non-root user (USER 1001 in this case).

    Have a look at the Dockerfile instruction: https://github.com/bitnami/bitnami-docker-kubectl/blob/master/1.24/debian-11/Dockerfile#L24

    So you can either

    Whatever works for you.

    Hope this helps!