
Nginx Ingress Controller는 Kubernetes에서 HTTP 및 HTTPS 트래픽을 클러스터 내부의 서비스로 라우팅하는 역할을 합니다.
로드 밸런싱, SSL 종료, URL 경로 기반 라우팅 등을 지원합니다.
예를 들어, 다음과 같은 YAML 파일로 Ingress를 설정할 수 있습니다.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-service
port:
number: 80
하지만 추가적인 로드 밸런싱 알고리즘을 설정하려면 주석을 추가할 수 있습니다.
annotations:
nginx.ingress.kubernetes.io/load-balance: "least_conn"
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-ingress-controller
spec:
template:
spec:
containers:
- name: nginx-ingress-controller
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
Docker에서는 컨테이너의 메모리 사용량을 제어할 수 있습니다.
Docker 컨테이너를 실행할 때 --memory 플래그를 사용하여 메모리 제한을 설정할 수 있습니다.
docker run --memory="256m" my-container
Docker Compose 파일에서도 메모리 설정을 할 수 있습니다.
version: '3.7'
services:
my-service:
image: my-image
deploy:
resources:
limits:
memory: 256M
reservations:
memory: 128M