쿠버네티스 Volume

(K8s volumes에서 넘어옴)

1 개요[ | ]

Kubernetes Volume, Volume
쿠버네티스 볼륨, 볼륨
  • 데이터를 담는 디렉토리
  • Pod 내 컨테이너들이 접근가능하다.
  • pod에 소속되는 동안 유지된다.
  • pod 내에서 구동되는 컨테이너들보다 오래 유지되며, 그 데이터는 컨테이너가 재시작되더라도 계속 보존된다.

Module 03 pods.svg

2 볼륨 유형 예시[ | ]

  • configMap, secret ★★
  • persistentVolumeClaim ★★
  • emptyDir
  • hostPath
  • local
  • fc (fiber channel), iscsi, nfs ★
  • rbd, cephfs, glusterfs
  • awsElasticBlockStore, azureDisk, azureFile, gcePersistentDisk, portworxVolume, vsphereVolume

3 yaml 블럭 예시[ | ]

volumes:
- name: vol-emtpy
  emptyDir: {}
- name: vol-config
  configMap:
    name: my-config
- name: vol-data
  persistentVolumeClaim:
    claimName: my-pvc
- name: vol-host
  hostPath:
    path: /any/path/it/will/be/replaced

4 두 컨테이너간 볼륨 공유[ | ]

two-container-pod.yaml[1]
apiVersion: v1
kind: Pod
metadata:
  name: two-containers
spec:
  restartPolicy: Never
  containers:
  - name: nginx-container
    image: nginx
    volumeMounts:
    - name: shared-data
      mountPath: /usr/share/nginx/html
  - name: debian-container
    image: debian
    volumeMounts:
    - name: shared-data
      mountPath: /pod-data
    command: ["/bin/sh"]
    args: ["-c", "echo Hello from the debian container > /pod-data/index.html"]
  volumes:
  - name: shared-data
    emptyDir: {}

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}