서비스(Service)와 인그레스(Ingress)는 모두 쿠버네티스에서 네트워크 트래픽을 관리하는 도구입니다.
공통점:
서비스의 역할: 서비스는 쿠버네티스 클러스터 내의 파드(Pod) 집합에 대한 네트워크 엔드포인트를 제공하고 관리합니다. 이를 통해 파드에 접근할 수 있으며, 로드 밸런싱 및 서비스 디스커버리를 지원합니다.
* 요약: 클러스너 내부 or 외부 -> pod
Ingress 역할: 클러스터 외부에서 안에 있는 파드에 접근할 때 사용하는 방법
* 요약: 클러스터 외부 -> service -> pod
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app.kubernetes.io/name: MyApp
ports:
- port: 80
# By default and for convenience, the `targetPort` is set to
# the same value as the `port` field.
targetPort: 80
# Optional field
# By default and for convenience, the Kubernetes control plane
# will allocate a port from a range (default: 30000-32767)
nodePort: 30007
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app.kubernetes.io/name: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
clusterIP: 10.0.171.239
type: LoadBalancer
status:
loadBalancer:
ingress:
- ip: 192.0.2.127
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx-example
rules:
- http:
paths:
- path: /testpath
pathType: Prefix
backend:
service:
name: test
port:
number: 80
[Kubernetes] 인그레스 컨트롤러 (0) | 2024.05.23 |
---|---|
[Kubernetes] pod 설명 (1) | 2024.05.21 |
[Kubernetes] Yaml 설명 (0) | 2024.05.21 |
[Kubernetes] 설치하기 (minikube) (0) | 2024.05.21 |
[Kubernetes] 아키텍처 (0) | 2024.05.21 |