Kubernetes/pod

pod <-> local 파일 업/다운로드

babbeolicoding 2023. 7. 27. 22:17

1. local -> pod 파일 업로드
kubectl cp {file_name} {pod_name}:{path}
ex) kubectl cp fileupload.txt test-deployment-112121-sdfwe:/app/fileupload.txt

 

2. pod -> local 파일 다운로드
kubectl cp {pod_name}:{file-path} {local-path}
ex) kubectl cp test-deployment-121212-dsfdfd:/app/fileupload.txt /home/user/fileupload.txt
"tar: Removing leading `/' from member names" 문구가 뜨지만
해당 메시지는 에러가 아니고 알림 메시지다.
압축할 파일의 경로에서 tar는 '/'를 제거했다는 뜻이다.
파일을 확인해 보면 다운로드가 잘 된 걸 볼 수 있다.

 

추가적으로 kubectl cp -h를 치면 cp 옵션에 대해서 자세히 확인할 수 있다.

'Kubernetes > pod' 카테고리의 다른 글

kubernetes pod 재시작하는 방법  (0) 2023.08.25