먼저 helm 을 이용하여 ingress-nginx 설치시 https://artifacthub.io/packages/helm/ingress-nginx/ingress-nginx 를 참고하며, controller.allowSnippetAnnotations: true 를 지정하여 설치하여야 한다.
그리고 Ingress 의 annotations 에 아래와 같이 configuration-snippet 를 설정해주면 된다.
...
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = http) {
return 301 https://$host:<리다이렉션 할 포트>$request_uri;
}
...
이렇게 하면 http 요청시 https 와 지정한 포트로 리다이렉션 된다. 수신 서버에서는 해당 포트를 https 포트로 지정하고 tls 설정을 해두면 된다.
'Kubernetes' 카테고리의 다른 글
| [KUBERNETES] ingress-nginx-controller 의 로드밸런싱 정책을 ewma 로 변경하기 (0) | 2026.08.01 |
|---|---|
| [KUBERNETES] Ingress 에서 base path 를 기준으로 연결 Service 구분하기 (0) | 2026.08.01 |
| [KUBERNETES] Ingress 에서 SSL Redirect 하기 (0) | 2026.07.29 |
| [KUBERNETES] tls 인증서를 Ingress 에 적용하기 (0) | 2026.07.29 |
| [KUBERNETES] Ingress 와 IngressController (feat. nginx) (0) | 2026.07.26 |