Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chown: changing ownership of ‘/var/lib/postgresql/data’: Operation not permitted, when running in kubernetes with mounted "/var/lib/postgres/data" volume #54601

arnold0617 opened this issue Oct 26, 2017 · 9 comments


Copy link

@arnold0617 arnold0617 commented Oct 26, 2017

I am running in kubernetes, pod crash loop back off all the time.

I found this message in log, "chown: changing ownership of ‘/var/lib/postgresql/data’: Operation not permitted"

Copy link

@k8s-github-robot k8s-github-robot commented Oct 26, 2017

There are no sig labels on this issue. Please add a sig label by:

  1. mentioning a sig: @kubernetes/sig-<group-name>-<group-suffix>
    e.g., @kubernetes/sig-contributor-experience-<group-suffix> to notify the contributor experience sig, OR

  2. specifying the label manually: /sig <label>
    e.g., /sig scalability to apply the sig/scalability label

Note: Method 1 will trigger an email to the group. See the group list and label list.
The <group-suffix> in the method 1 has to be replaced with one of these: bugs, feature-requests, pr-reviews, test-failures, proposals

@k8s-github-robot k8s-github-robot added the needs-sig label Oct 26, 2017
Copy link

@arnold0617 arnold0617 commented Oct 27, 2017

I fixed this problem.

This is caused by the parameter of nfs, after setting nfs mount parameter like below, it works fine.
/nfs/data *(rw,sync,no_subtree_check,no_root_squash)

Copy link

@mpun mpun commented Nov 12, 2017

It worked for me. You saved my day.

Copy link

@RomanGalochkin RomanGalochkin commented Nov 22, 2017

It does not work for me.

Copy link

@RomanGalochkin RomanGalochkin commented Nov 23, 2017

To solve this problem do it:

  1. Set NFS export dir:
    "nfs/main *(rw,sync,no_subtree_check,no_root_squash)"
    And then restart NFS server:
    sudo /etc/init.d/nfs-kernel-server restart
    sudo exportfs -arv
  2. Set NFS volume like this:
    server: ***
    path: "nfs/main/data"
  1. Update your entity configuration:
            - name: postgres-storage
              mountPath: /var/lib/postgresql/data
              readOnly: false

Copy link

@malcolmm83 malcolmm83 commented Dec 20, 2017

I guess the only alternative really is run as non-root?

Copy link

@RomanGalochkin RomanGalochkin commented Dec 21, 2017

No, it is not alternative.

Copy link

@mhellsten mhellsten commented Oct 28, 2018

I got past it by setting userid and groupid to 999 on the container (the IDs of the mysql user and groups inside the container).

Copy link

@ThePlenkov ThePlenkov commented Nov 30, 2018

@mhellsten did you use security context for this?

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

No branches or pull requests

7 participants