Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Tags
more
Archives
Today
Total
관리 메뉴

클라우드 배우기

Kubernetes(K8S): POD 및 Service 구성 본문

kubernetes

Kubernetes(K8S): POD 및 Service 구성

새싹싹이 2023. 10. 5. 20:56

생성

NameSpace 생성

vi name.yml

---
apiVersion: v1
kind: Namespace
metadata:
  name: n1

---
apiVersion: v1
kind: Namespace
metadata:
  name: n1

kubectl apply -f name.yml

 

POD 생성

kubectl run test-http --image httpd --port 80 --namespace n1

kubectl get pods

 

Service 외부 노출

kubectl expose pod test-http --type=NodePort

kubectl get service -o wide -n n1

30935 포트를 사용하는 것을 확인할 수 있음

 

 

인터넷창

각 IP 주소에 :30935 를 붙이면 하기와 같은 창 출력

 

삭제

service 삭제

kubectl delete svc test-http -n n1

 

pod 삭제

kubectl delete pod test-http -n n1

 

확인

kubectl get all -o wide -n n1

 

Namespace 삭제

kubectl delete -f name.yml