GitHub Actions 워크플로에서 container 옵션을 사용해 Kubernetes 파드의 볼륨을 마운트하려고 하는데, 파일이 디렉터리로 생성되는 문제가 있습니다.
Kubernetes에서의 볼륨 설정은 다음과 같습니다.
volumeMounts: - name: credential-config mountPath: /runner/config/credentials.ini subPath: credentials.ini volumes: - name: credential-config configMap: name: cred-config
Kubernetes 파드 안에서 실행한 명령어:
$ id uid=1001(runner) gid=1001(runner) groups=1001(runner),27(sudo),123(docker) $ ls -l /runner/config/credentials.ini -rw-r--r-- 1 root root 116 Aug 5 18:31 /runner/config/credentials.ini
ConfigMap 확인:
$ kubectl get configmap cred-config -o yaml apiVersion: v1 data: credentials.ini: | info = info anotherinfo = info kind: ConfigMap
그 다음, GitHub Workflow에서 다음과 같이 설정했습니다.
container: image: some-image@sha256:some-sha volumes: - /runner/config/credentials.ini:/tmp/credentials.ini
그리고 워크플로 안에서 실행한 명령어:
$ id uid=0(root) gid=0(root) groups=0(root) $ ls -l /tmp/credentials.ini drwxr-xr-x 2 root root 4096 Jul 28 23:07 credentials.ini
결과적으로 credentials.ini가 디렉터리로 잡힙니다. 혹시 이 문제를 해결할 방법이 있을까요? 며칠째 머리가 아프네요…