This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.27.7. 하위 경로 지정
volumeMounts.subPath
속성을 사용하여 볼륨의 루트 대신 볼륨 내부에 subPath
를 지정합니다. subPath
를 사용하면 단일 Pod에서 여러 용도로 하나의 볼륨을 공유할 수 있습니다.
볼륨의 파일 목록을 보려면 oc rsh
명령을 실행합니다.
oc rsh <pod>
$ oc rsh <pod>
sh-4.2$ ls /path/to/volume/subpath/mount
example_file1 example_file2 example_file3
subPath
를 지정합니다.
subPath 사용량의 예
apiVersion: v1 kind: Pod metadata: name: my-site spec: containers: - name: mysql image: mysql volumeMounts: - mountPath: /var/lib/mysql name: site-data subPath: mysql - name: php image: php volumeMounts: - mountPath: /var/www/html name: site-data subPath: html volumes: - name: site-data persistentVolumeClaim: claimName: my-site-data
apiVersion: v1
kind: Pod
metadata:
name: my-site
spec:
containers:
- name: mysql
image: mysql
volumeMounts:
- mountPath: /var/lib/mysql
name: site-data
subPath: mysql
- name: php
image: php
volumeMounts:
- mountPath: /var/www/html
name: site-data
subPath: html
volumes:
- name: site-data
persistentVolumeClaim:
claimName: my-site-data