네임스페이스
클러스터 하나를 여러 논리적인 단위로 사용
하나의 쿠버네티스에 5개의 namespace를 사용한다고 하면 pod를 5개의 영역으로 쓸 수 있음
- api는 하나이지만 마치 여러개 있는것처럼 사용 가능
namespace 관련 실습
아무 설정하지 않으면 namespace는 default namespace를 사용
kubectl get pod No resources found in default namespace.
네임스페이스 생성
kubectl create namespace test
네임스페이스 확인
kubectl get namespace
kubectl get pods -n ${namespace}
네임스페이스 생성을 위한 yaml file 생성하기
kubectl create namespace test --dry-run -o yaml > test.yaml kubectl create -f test.yaml
yaml 파일에 네임스페이스 지정
yaml 파일의 metadata 에 namespace 지정
default namespace 변경하기
- config 등록하기
kubectl config set-context test@kubernetest --cluster=kubernetest --user=kubernetes-admin --namespace=test
추가된 쿠버네티스 config 확인하기
kubectl config view
default namespace 확인하기
kubectl config current-context
변경하기
kubectl config use-context test@kubernetes
네임스페이스 지우기
kubectl delete namespaces test
'쿠버네티스' 카테고리의 다른 글
쿠버네티스 명령어 정리 (0) | 2022.03.28 |
---|---|
쿠버네티스 yaml 파일과 api 버전 (0) | 2022.03.20 |
쿠버네티스 컨테이너 동작 원리 및 아키텍쳐 (0) | 2022.03.20 |
쿠버네티스 간단 실습(pod 만들기 / 수정하기) (0) | 2022.03.18 |
쿠버네티스 설치하기 (0) | 2022.03.18 |