728x90
반응형
- 서비스 퍼블리싱 : 외부에서 Pod로 트래픽 연결
- 서비스 디스커버리 : 내부 DNS를 이용한 Service 이름으로 API 호출
- 서비스 레지스트리 : Pod의 IP를 등록/제거
ㅁ 실습
> 1. Pod 내부에서 Service 명으로 API 호출 ( 서비스 디스커버리 )
// Version API 호출
curl http://api-tester-1231:80/version
> 2. Deployment에서 Pod의 ports 전체 삭제, Service tagetPort를 http -> 8080으로 수정 후 Service명으로 API 호출
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: anotherclass-123
name: api-tester-1231
spec:
template:
spec:
nodeSelector:
kubernetes.io/hostname: k8s-master
containers:
- name: api-tester-1231
ports: // 삭제
- name: http // 삭제
containerPort: 8080 // 삭제
---
apiVersion: v1
kind: Service
metadata:
namespace: anotherclass-123
name: api-tester-1231
spec:
ports:
- port: 80
targetPort: http -> 8080 // 변경
nodePort: 31231
type: NodePort
curl http://api-tester-1231:80/version
> 참고 URL :
728x90
반응형
'Container > Kubernetes' 카테고리의 다른 글
[Kubernetes] Component 동작으로 이해하기 (0) | 2024.06.07 |
---|---|
[Kubernetes] Application 기능으로 이해하기 - HPA (1) | 2024.06.05 |
[Kubernetes] Application 기능으로 이해하기 - Deployment (0) | 2024.06.05 |
[Kubernetes] Application 기능으로 이해하기 - PV/PVC (0) | 2024.06.05 |
[Kubernetes] Application 기능으로 이해하기 - Configmap, Secret (0) | 2024.05.29 |