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

Closed
arnold0617 opened this issue Oct 26, 2017 · 9 comments
Labels

Comments

@arnold0617
Copy link

@arnold0617 arnold0617 commented Oct 26, 2017

I am running docker.io/postgres:9.6.5 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"

@k8s-github-robot

This comment has been minimized.

Copy link
Contributor

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

@arnold0617
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

@arnold0617

This comment has been minimized.

Copy link
Author

@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)

@arnold0617 arnold0617 closed this Oct 27, 2017
@mpun

This comment has been minimized.

Copy link

@mpun mpun commented Nov 12, 2017

It worked for me. You saved my day.

@RomanGalochkin

This comment has been minimized.

Copy link

@RomanGalochkin RomanGalochkin commented Nov 22, 2017

It does not work for me.

@RomanGalochkin

This comment has been minimized.

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
    or
    sudo exportfs -arv
  2. Set NFS volume like this:
  nfs:
    server: ***
    path: "nfs/main/data"
  1. Update your entity configuration:
         volumeMounts:
            - name: postgres-storage
              mountPath: /var/lib/postgresql/data
              readOnly: false
@malcolmm83

This comment has been minimized.

Copy link

@malcolmm83 malcolmm83 commented Dec 20, 2017

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

@RomanGalochkin

This comment has been minimized.

Copy link

@RomanGalochkin RomanGalochkin commented Dec 21, 2017

No, it is not alternative.

@mhellsten

This comment has been minimized.

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).

@ThePlenkov

This comment has been minimized.

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.