Minikube host directory 마운트하기
2024. 12. 31. 11:55ㆍk8s
apiVersion: v1
kind: Pod
metadata:
name: host-mount-pod
spec:
containers:
- name: test-container
image: busybox
command: [ "sleep", "3600" ]
volumeMounts:
- mountPath: /data
name: host-volume
volumes:
- name: host-volume
hostPath:
path: /mnt/data
특정 그룹으로 마운트하기(작동안함)
apiVersion: v1
kind: Pod
metadata:
name: host-mount-pod
spec:
securityContext:
fsGroup: 2000 # Group ID of the specific account
containers:
- name: test-container
image: busybox
command: [ "sleep", "3600" ]
volumeMounts:
- mountPath: /data
name: host-volume
volumes:
- name: host-volume
hostPath:
path: /mnt/data
특정 사용자로 마운트하기(작동안함)
apiVersion: v1
kind: Pod
metadata:
name: host-mount-pod
spec:
securityContext:
runAsUser: 1000 # Replace with the user ID
containers:
- name: test-container
image: busybox
command: [ "sleep", "3600" ]
volumeMounts:
- mountPath: /data
name: host-volume
volumes:
- name: host-volume
hostPath:
path: /mnt/data
init Container를 사용해서 변경(작동함)
apiVersion: v1
kind: Pod
metadata:
name: host-mount-pod
spec:
initContainers:
- name: volume-permission-fix
image: busybox
command: ["sh", "-c", "chown -R 1000:1000 /data"]
volumeMounts:
- mountPath: /data
name: host-volume
containers:
- name: test-container
image: busybox
command: [ "sleep", "3600" ]
volumeMounts:
- mountPath: /data
name: host-volume
volumes:
- name: host-volume
hostPath:
path: /mnt/data
'k8s' 카테고리의 다른 글
Docker Volume Mount와 NFS Mount의 차이점 (0) | 2024.12.31 |
---|---|
Minikube mount (0) | 2024.12.31 |
docker registry 조회 명령 (0) | 2024.07.06 |
디버깅에 유용한 명령어 (0) | 2024.05.05 |
ConfigMap 마운트 (0) | 2024.05.04 |