origin icon indicating copy to clipboard operation
origin copied to clipboard

registry does not have write permission when use glusterfs as back storage

Open pstinghua opened this issue 11 years ago • 14 comments

pstinghua avatar Nov 17 '15 11:11 pstinghua

glusterfs endpoints

apiVersion: v1
kind: Endpoints
metadata:
  name: glusterfs-cluster
subsets:
  - addresses:
      - ip: 193.0.10.166
    ports:
      - port: 1
  - addresses:
      - ip: 193.0.10.167
    ports:
      - port: 1

glusterfs pv

apiVersion: v1
kind: PersistentVolume
metadata:
  name: docker-registry
spec:
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteMany
  glusterfs:
    endpoints: glusterfs-cluster
    path: docker-registry
    readOnly: false
  persistentVolumeReclaimPolicy: Retain

add registry volume

oc volume dc docker-registry --add --overwrite --name=registry-storage --mount-path=/registry --claim-name=docker-registry --claim-size=20Gi --claim-mode=rwm --type=persistentVolumeClaim

registry log

time="2015-11-17T11:12:31Z" level=info msg="filesystem.PutContent(\"/docker/registry/v2/repositories/demo/nodejs-ex/_uploads/ac244ee1-e536-4eed-89ed-ebd274325a7f/startedat\")" trace.duration=25.033777ms trace.file="/go/src/github.com/openshift/origin/Godeps/_workspace/src/github.com/docker/distribution/registry/storage/driver/base/base.go" trace.func="github.com/docker/distribution/registry/storage/driver/base.(*Base).PutContent" trace.id=0cf95673-9a58-445a-b966-c1faed3cd9c6 trace.line=67 
16
time="2015-11-17T11:12:31Z" level=error msg="An error occured" err.code=UNKNOWN err.detail="mkdir /registry/docker: permission denied" err.message="unknown error" http.request.host="172.30.119.17:5000" http.request.id=f69a39cc-098a-4261-86a5-cfffdda764d2 http.request.method=POST http.request.remoteaddr="10.1.3.1:44707" http.request.uri="/v2/demo/nodejs-ex/blobs/uploads/" http.request.useragent="docker/1.8.2 go/go1.4.2 kernel/3.10.0-229.20.1.el7.x86_64 os/linux arch/amd64" instance.id=a82f15f3-4b5b-42e8-a624-7804d2a518d7 vars.name="demo/nodejs-ex" 
17
time="2015-11-17T11:12:31Z" level=info msg="response completed" http.request.host="172.30.119.17:5000" http.request.id=f69a39cc-098a-4261-86a5-cfffdda764d2 http.request.method=POST http.request.remoteaddr="10.1.3.1:44707" http.request.uri="/v2/demo/nodejs-ex/blobs/uploads/" http.request.useragent="docker/1.8.2 go/go1.4.2 kernel/3.10.0-229.20.1.el7.x86_64 os/linux arch/amd64" http.response.contenttype="application/json; charset=utf-8" http.response.duration=254.063505ms http.response.status=500 http.response.written=111 instance.id=a82f15f3-4b5b-42e8-a624-7804d2a518d7 
18
10.1.3.1 - - [17/Nov/2015:11:12:30 +0000] "POST /v2/demo/nodejs-ex/blobs/uploads/ HTTP/1.1" 500 111 "" "docker/1.8.2 go/go1.4.2 kernel/3.10.0-229.20.1.el7.x86_64 os/linux arch/amd64"

pstinghua avatar Nov 17 '15 11:11 pstinghua

If you deployed with openshift_ansible it is probably related to https://github.com/openshift/openshift-ansible/pull/903

detiber avatar Nov 17 '15 13:11 detiber

yes, but after set virt_sandbox_use_fusefs, it still have not write permision

pstinghua avatar Nov 17 '15 14:11 pstinghua

had the same problem, fix was to change the posix permission inside the mounted volume (eg on glusterfs server) chmod 777 . did the trick

gemafra avatar Nov 22 '15 20:11 gemafra

@danmcp We are setting both virt_sandbox_use_fusefs and virt_use_fusefs in openshift-ansible, With the resolution mentioned by @gorg3b it seems like this is more of a documentation issue now.

detiber avatar Nov 30 '15 21:11 detiber

It does not seem acceptable to require customers to change perms on their existing (brownfield) glusterfs-fuse mount dir. I cannot tell from @detiber's comment if the chmod 777 is still required to fix the issue. If so then I think rather than chmod 777 it is better to define supplementalGroups in the pod spec to match the mount's GID, or change the project's default supp-GID to be the GID of the gluster mount dir.

jeffvance avatar Jan 14 '16 00:01 jeffvance

hi, the chmod was actually just a quick work around / for testing purposes, since documentation on supplementalGroups was not available at the time.

gemafra avatar Jan 14 '16 07:01 gemafra

I have the exact same issue, but its with iscsi. Changing permissions on the host allows the registry to work properly. After testing a few permissions 770 is the tightest permission that can be used. I changed ownership of the directory with the same results

this-tech avatar Jan 22 '16 13:01 this-tech

@pstinghua Do you mean that you cannot push images to the docker registry? See the instructions for Accessing the Registry Directly. I think the Prerequisite section may be helpful.

Per to docs:

For writing or pushing images, for example when using the docker push command, the user must have the system:image-builder role. To add this role:

$ oadm policy add-role-to-user system:image-builder <user_name>

copejon avatar Mar 02 '16 23:03 copejon

@pstinghua Was this useful?

copejon avatar Mar 18 '16 21:03 copejon

@pstinghua please test solution so we may close this issue

erinboyd avatar Mar 23 '16 04:03 erinboyd

@erinboyd, do you know if this can be closed?

brenton avatar Jun 06 '16 13:06 brenton

supplementalgroups can be defined for the registry now so i'm going to assume this can be closed. we can reopen if someone still has concerns.

bparees avatar Oct 13 '17 19:10 bparees

HI in. my case, image image

jaki300 avatar Apr 18 '22 21:04 jaki300