카테고리 없음

🌐 Ingress-NGINX란?

idea9329 2025. 3. 28. 16:49
반응형

 

✅ 정의

  • Ingress는 Kubernetes 리소스로, 외부에서 클러스터 내부 서비스에 접근할 수 있도록 URL 라우팅 규칙을 정의함
  • Ingress Controller는 Ingress 리소스를 실제로 실행해주는 컴포넌트
  • ingress-nginx는 그 중 가장 많이 쓰이는 NGINX 기반의 오픈소스 Ingress Controller

🧩 아키텍처

[사용자 브라우저]
       ↓
  [Ingress-NGINX Controller]  ← 외부 LoadBalancer 또는 NodePort로 연결
       ↓
  [Kubernetes Ingress Rule]
       ↓
  [서비스 (Service)]
       ↓
  [파드 (Pod)]

📦 ingress-nginx의 주요 기능

기능설명

URL 기반 라우팅 /api → A 서비스, /admin → B 서비스
도메인 기반 라우팅 foo.example.com → 서비스 A
TLS (HTTPS) 지원 SSL 인증서 자동 적용
리버스 프록시 요청을 적절한 서비스로 전달
Rate Limit, Rewrite, Redirect 고급 트래픽 제어 가능
Helm 설치 지원 간편한 설치와 업그레이드

⚙️ 설치 예시 (Helm)

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update

helm install ingress-nginx ingress-nginx/ingress-nginx

📑 Ingress 리소스 예시

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - host: myapp.example.com
      http:
        paths:
          - path: /app
            pathType: Prefix
            backend:
              service:
                name: my-app-service
                port:
                  number: 80

이 예시는 myapp.example.com/app으로 들어온 요청을 my-app-service로 라우팅합니다.


🔐 TLS 적용 예시

spec:
  tls:
    - hosts:
        - myapp.example.com
      secretName: my-tls-secret

 myapp.example.com에 대한 HTTPS 접속이 가능해짐


🔥 ingress-nginx vs 다른 Ingress Controller

Controller설명

ingress-nginx NGINX 기반, 가장 대중적, 유연함
Traefik 설정 간편, 대시보드 지원
AWS ALB Ingress AWS ALB 연동, 자동 관리
Istio Ingress 서비스 메시와 통합 (복잡함)

✅ ingress-nginx는 언제 쓰나?

  • 하나의 외부 IP로 여러 서비스 운영할 때
  • URL path/domain별로 요청을 나누고 싶을 때
  • HTTPS 인증서를 자동으로 붙이고 싶을 때 (Let's Encrypt와도 잘 작동)
반응형