쿠버네티스 스토리지 & EmptyDir

쿠버네티스 스토리지 & EmptyDir

728x90

# 쿠버네티스 스토리지

- 임시볼륨: 컨테이너간 공유위해

- 로컬볼륨: 노드간 공유위해

# EmptyDir을 활용한 컨테아너 간 데이터 공유

- 공유디렉토리 : 볼륨

- 컨테이너별 디렉토리를 볼륨을 통해 공유디렉토리로 활용할 수있음

# EmptyDir 활용 실습

# 관련 내용찾기

쿠버네티스 공식사이트 > 검색 > volumes > 쓰고자하는 볼륨모델 선택 > EmptyDir > 관련소스 복사

vim count-httpd.yaml

apiVersion: v1 kind: Pod metadata: name: count spec: containers: - image: gasbugs/count name: html-generator volumeMounts: - name: html mountPath: /var/htdocs - image: httpd name: web-server volumeMounts: - name: html mountPath: /usr/local/apache2/htdocs readOnly: true ports: - containerPort: 80 protocol: TCP volumes: - name: html emptyDir: {}

kubectl create -f count-httpd.yaml kubectl get pod -w

# 서비스 요청하기

- ip주소확인

kubectl get pod -o wide

# curl 명령을통해 서비스 확인하기

kubectl exec -it --curl 10.108.2.38

# http-go 서비스 실행하기

kubectl create deploy http-go --image=may9noy/http-go kubectl exec -it http-go-587945f5c4-vf7nx -- curl 10.108.2.38

728x90

from http://may9noy.tistory.com/249 by ccl(A) rewrite - 2021-09-11 16:00:20