반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- Flux
- 도커
- Kafka
- codedeploy
- bootstrap
- chartjs
- AWS CI/CD 구축하기
- or some instances in your deployment group are experiencing problems.
- COALESCE
- Airflow
- aws cicd
- kubeflow
- JavaScript
- codebuild
- VPN
- node
- Spring Error
- java bigdecimal
- codedeploy error
- PostgreSQL
- Jenkins
- aws
- Python
- SQL
- Spring
- IntelliJ
- redis
- docker
- chart.js
- codepipeline
Archives
- Today
- Total
Small Asteroid Blog
Kubernetes Service 포트 - NodePort, port, targetPort 본문
728x90
Servie-port
서비스 포트로 요청받은 것을 파드의 어느 포트로 포워딩할 지 설정하는 것이다.
클러스터 외부에서
노드의 IP 주소와 서비스의 nodePort 로 요청이 되면
서비스의 port 로 포워딩되고
파드에서 targetPort로 들어간다.
apiVersion: v1
kind: Service
metadata:
name: dev-svc
spec:
type: NodePort ## type 추가
ports:
- port: 80
protocol: TCP
targetPort: 8080
nodePort: 31000 ## nodePort 입력
selector:
app: dev-pod
NodePort
- 외부에서 접속하기 위해 사용하는 포트
해당 포트 번호를 통해 외부에서 접근한다.
port
- Cluster 내부에서 사용할 Service 객체의 포트
targetPort
- Service객체로 전달된 요청을 Pod(deployment)로 전달할때 사용하는 포트
- 서비스 동작을 위해 어플리케이션이 이 포트에 대해 네트워크 요청을 받고 있어야 함
서비스 흐름으로 보면 NodePort --> Port --> targetPort 이다.
예시
아래 이미지에서
PORT(S) 에서
80 은 내부의 grafana 의 port이고
31000은 외부에서 접근할 수 있는 NodePort이다.
그럼 http://localhost:31000 로 접근할 수 있다.
nodeport 하기 전에는 http://localhost:8080 으로 접근해야 한다.
728x90
반응형
'클라우드 및 인프라 > Kubernetes' 카테고리의 다른 글
[kubernetes] kube-proxy란 (0) | 2023.05.14 |
---|---|
[DKT CKA Study] 5Day - 2023.05.10 (0) | 2023.05.10 |
Mac OS brew uninstall 오류/ Mac OS 패키지 삭제 - Error: No such keg: /opt/homebrew/Cellar/redis (0) | 2023.05.02 |
[Helm] helm 으로 Grafana, Redis 설치하고 Grafana에 Redis 연결하기 (0) | 2023.04.28 |
[Helm] Mac에 Helm 설치하기 (0) | 2023.04.21 |