
- Kubernetes ingress
- 하나의 IP로 여러 서비스 관리 가능
- URL 기반으로 다른 서비스로 연결 가능
- SSL/TLS 인증서 한 곳에서 관리
- Kubernetes Ingress 흐름도

- Nginx Ingress Controller 정보
https://github.com/kubernetes/ingress-nginxGitHub – kubernetes/ingress-nginx: Ingress NGINX Controller for KubernetesIngress NGINX Controller for Kubernetes. Contribute to kubernetes/ingress-nginx development by creating an account on GitHub.github.com
- Nginx Ingress Controller 지원 범위

1. Nginx Ingress Controller
- Nginx Ingress Controller 설치
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.0-beta.0/deploy/static/provider/cloud/deploy.yaml

- Ingress Pod 정보
kubectl get pods -n ingress-nginx

- IngressService 정보
kubectl get svc -n ingress-nginx

2. Deployment & Service
- front Serivce
apiVersion: apps/v1 kind: Deployment metadata: name: front spec: replicas: 3 selector: matchLabels: app: front template: metadata: name: front labels: app: front spec: containers: - name: nginx image: nginx ports: - name: http containerPort: 80 protocol: TCP --- apiVersion: v1 kind: Service metadata: name: front labels: app: front spec: type: ClusterIP ports: - name: http protocol: TCP port: 8080 targetPort: 80 selector: app: front
- backend Service
apiVersion: apps/v1 kind: Deployment metadata: name: fast labels: app: fast spec: replicas: 1 selector: matchLabels: app: fast template: metadata: labels: app: fast spec: containers: - name: fast image: monta010/fastapi ports: - name: http containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: fast labels: app: fast spec: type: ClusterIP ports: - name: http protocol: TCP port: 80 targetPort: 80 selector: app: "fast"
3. Ingress 설정
- Ingress Path Rule 설정
- /front -> Service front 호출
- /backend -> Service backend 호출
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: path annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: ingressClassName: nginx rules: - http: paths: - path: /front pathType: Prefix backend: service: name: front port: name: http - http: paths: - path: /backend pathType: Prefix backend: service: name: backend port: name: http
- /front 호출

- backend 호출
