Trouble Shooting

[삽질의 추억] K8s + synology nfs + pvc + nexus 조합에서 docker push 할때에 permission denied

[혜안] 2023. 12. 3. 23:36
728x90
2023-12-03 13:31:35,477+0000 ERROR [qtp105343482-3699] org.sonatype.nexus.blobstore.file.FileBlobStore - Unable to load BlobAttributes for blob id: f4816abe-9b8b-49c5-adf8-78108604b534, path: /nexus-data/blobs/default/content/vol-29/chap-10/f4816abe-9b8b-49c5-adf8-78108604b534.properties, exception: /nexus-data/blobs/default/content/vol-29/chap-10/f4816abe-9b8b-49c5-adf8-78108604b534.properties (Permission denied)

아직 근본 원인은 못찾아서, 임시조치 방법만 기술합니다.

환경

Synology NAS에 NFS 서비스 활성화

docker에서 nfs-subdir-external-provisioner 띄워놓고,

StorageClass를 통해 nexus 용 PVC 를 생성했습니다.

 

그런데 docker 이미지를 push하면, 최초 이미지는 성공하는데,

태깅하여 버전을 올리면 실패합니다.

예를 들면,

device-manager라는 mqtt용 제어모듈을 docker  이미지로 빌드해서 0.1 버전으로 태깅 후 최초 푸시하면 성공합니다.

그런데 소스 수정하고 이미지 다시 빌드해서 0.2버전으로 푸시하면 아래와 같이 재시도만 무한히 반복하다가 실패합니다.

$ docker push xxxxxxxxx.xxx/device-manager:0.2
[2023-12-03 22:28:42.732] The push refers to repository [xxxxxxxxxxx.xxx:5000/device-manager]
[2023-12-03 22:28:42.755] 
[2023-12-03 22:28:42.755] d4aeff9f91c8: Pushing [=====================================>             ]  14.43MB 
[2023-12-03 22:28:42.755] 3a1433441284: Pushing [=================================================> ]  18.89MB
[2023-12-03 22:28:42.755] 18875737318f: Retrying in 6 seconds 
[2023-12-03 22:28:42.755] ab41df14f50f: Retrying in 5 seconds
[2023-12-03 22:28:42.755] 5372932166ca: Pushing [================================================>  ]  7.362MB
[2023-12-03 22:28:42.777] f896fc9e11e2: Pushing [==================================>                ]  13.19MB
[2023-12-03 22:28:42.777] 6b32dd61ec7a: Retrying in 19 seconds

 

nexus 로그를 보면 아래와 같은 에러가 발생 중이고요.

2023-12-03 13:31:35,477+0000 ERROR [qtp105343482-3699]  org.sonatype.nexus.blobstore.file.FileBlobStore - Unable to load BlobAttributes for blob id: f4816abe-9b8b-49c5-adf8-78108604b534, path: /nexus-data/blobs/default/content/vol-29/chap-10/f4816abe-9b8b-49c5-adf8-78108604b534.properties, exception: /nexus-data/blobs/default/content/vol-29/chap-10/f4816abe-9b8b-49c5-adf8-78108604b534.properties (Permission denied)

 

그런데 nfs 폴더에 가보면 해당 폴더와 파일은 멀쩡히 존재합니다.

$ k exec -it nexus-dc7b5c84b-cqw4x bash
bash-4.4$ ls -al /nexus-data/blobs/default/content/vol-29/chap-10/f4816abe-9b8b-49c5-adf8-78108604b534.properties
-rw-r--r-- 1 nexus nexus 418 Nov 30 14:48 /nexus-data/blobs/default/content/vol-29/chap-10/f4816abe-9b8b-49c5-adf8-78108604b534.properties

 

그런데 파일 안으로 들거갈 수가 없습니다.

bash-4.4$ cd /nexus-data/blobs/
bash: cd: /nexus-data/blobs/: Permission denied

 

뭔일이고 하니,

bash-4.4$ ls -al
total 80
drwxrwxrwx  15 root  root   4096 Nov 22 14:18 .
drwxr-xr-x   1 root  root   4096 Nov 22 14:18 ..
drw-rw-r--   3 nexus nexus  4096 Nov 21 05:17 blobs
drwxr-xr-x 336 nexus nexus 12288 Nov 22 14:19 cache
drwxr-xr-x   7 nexus nexus  4096 Nov 21 05:16 db
drwxr-xr-x   3 nexus nexus  4096 Nov 22 06:36 elasticsearch
drwxr-xr-x   3 nexus nexus  4096 Nov 21 05:14 etc
drwxr-xr-x   2 nexus nexus  4096 Nov 21 05:14 generated-bundles
drwxr-xr-x   2 nexus nexus  4096 Nov 21 05:14 instances
drwxr-xr-x   3 nexus nexus  4096 Nov 21 05:14 javaprefs
-rw-r--r--   1 nexus nexus     1 Nov 22 14:18 karaf.pid
drwxr-xr-x   3 nexus nexus  4096 Nov 21 05:16 keystores
-rw-r--r--   1 nexus nexus    23 Nov 22 14:18 lock
drwxr-xr-x   5 nexus nexus  4096 Dec  3 13:27 log
drwxr-xr-x   2 nexus nexus  4096 Nov 21 05:16 orient
-rw-r--r--   1 nexus nexus     5 Nov 22 14:18 port
drwxr-xr-x   2 nexus nexus  4096 Nov 21 05:16 restore-from-backup
drwxr-xr-x   7 nexus nexus  4096 Nov 22 14:20 tmp

 

blobs 폴더에만 실행권한이 없습니다.

이게 무슨 일인가요?

 

그래서 일단 실행권한을 줘봅니다.

bash-4.4$ chmod -R +x /nexus-data/blobs/

 

그리고 다시 푸시를 해봅니다.

$ docker push xxxxxxxxxxxx.xxx:5000/device-manager:0.2
The push refers to repository [xxxxxxxxxxxx.xxx:5000/device-manager]
d4aeff9f91c8: Layer already exists
3a1433441284: Pushed
18875737318f: Pushed
ab41df14f50f: Pushed
5372932166ca: Layer already exists
f896fc9e11e2: Pushed
6b32dd61ec7a: Pushed
a7b671d1566d: Layer already exists
0.2: digest: sha256:55bdc8b845f12xxxxxxxxxxxx9dd36a6xxxxf54a98e9f5dd8be552b8e7 size: 1992

성공했습니다.

 

왜 실행권한이 빠졌는지 원인을 밝히지는 못했습니다.

혹시 아시면 댓글을 달아주십시요.

728x90