Develop/k8s

Nginx Ingress Controller Annotations 설정

팡연 2022. 12. 8. 23:29
반응형

Nginx Ingress Controller 사용시 Nginx 와 관련된 기본적인 설정할 때 Annotaions기능을 통해 적용할 수 있다

예를들면 기본적으로 Nginx Ingress Controller 에 client_max_body_size 가 1m로 설정되어있는데,

ingress.yaml 의 Annotations을 통해 Nginx Controller Pod에 접속하지 않아도 Nginx 설정을 할 수 있다.

 

단, Nginx Ingress Controller의 경우 kubernetes Ingress Controller(Community Version)와

Nginx Ingress Controller가 있는데, 이를 잘 보고 적용해야한다.

 

1. kubernetes Ingress Controller(Community Version)

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cafe-ingress-with-annotations
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 8m   
spec:
  rules:
     ...

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/

 

2. Nginx Ingress Controller

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cafe-ingress-with-annotations
  annotations:
    nginx.org/client-max-body-size: 4m
spec:
  rules:
     ...

https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations

 

 

반응형