Namespace
: 하나의 k8s Cluster를 여러개 논리적인 단위(namespace)로 나누어서 개체를 관리하는 것
(App 배포 및 Project를 진행할 때 편리)
namespace 생성하기
- kubectl create ns globalvision
- kubectl run myhome --image=nginx --port 80 -n globalvision
- kubectl run mygame --image pengbai/docker-supermario --port 8080 -n globalvision
- kubectl get pod -n globalvision : 확인
서비스 생성
- kubectl api-resources | grep -i service : Namespace를 지정해야 하는지 확인.(namespace 부분이 true라면 지정해야 함)
- kubectl expose pod mygame --type NodePort --port 8080 -n globalvision
1. Polaris dashboard 앱 생성
- kubectl apply -f https://github.com/fairwindsops/polaris/releases/download/5.2.0/dashboard.yaml
- kubectl expose -n polaris deployment polaris-dashboard --type=NodePort --name=polaris2 --port=8080
- kubectl get svc -n polaris
Polaris dashboard 앱 삭제
- kubectl delete ns polaris
2. Chaos Mesh 앱생성(script로설치)
- curl -o chaos.sh https://mirrors.chaos-mesh.org/v2.0.1/install.sh : 다운로드
- curl -sSL https://mirrors.chaos-mesh.org/v2.0.1/install.sh | bash : 설치
Chaos Mesh dashboard 앱 삭제
- kubectl delete ns chaos-testing
--> k8s에서 App을 배포할 때는 App을 만든 개발자는 그 App에 대한 고유한 namespace를 만들어서 App을 배포하도록 하는 경향이 있다. 이렇게 하면 어떤 App이 설치 되었는지 쉽게 알 수 있고 삭제할 때도 참 편리하다.
- kubectl delete -f http://down.cloudshell.kr/k8s/metallb.yaml
- kubectl delete -f http://down.cloudshell.kr/k8s/namespace.yaml
- kubectl delete ns globalvision
'Study > Cloud' 카테고리의 다른 글
Kubernetes - Service (0) | 2022.07.22 |
---|---|
Kubernetes - Pod (0) | 2022.07.21 |
Kubernetes - yaml (0) | 2022.07.21 |
Kubernetes - Deployment & Service (0) | 2022.07.20 |
Kubernetes 소개 및 설치 (0) | 2022.07.19 |