Table of Contents |
---|
Info |
---|
여기서 사용되는 예제는 아래 블로그의 예제를 응용하여 적용하였다. 단, 현재의 k8s api 버전 스펙에 맞지 않는 경우가 있고, Nginx-ingress 역시 위 예제에서 사용되는 것과는 차이가 있다.(기본 NodePort 서비스를 생성해준다. 그러므로 3.4.1 절의 내용은 이미 생성되어 있을 것이다.) 그래서 아래 노트 박스에서와 같이 yaml들을 수정/보완하여 적용하였다. |
...
Code Block | ||
---|---|---|
| ||
# 먼저 접속할 포트를 조회. $ kubectl get svc -n ingress-nginx NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ingress-nginx-controller NodePort ClusterIP 10.111107.215174.109150 10.20.2.217,10.20.2.218 80:30813/TCP 32m 443/TCP 78m38s $ curl --resolve alicek106.example.com:80:10.20.2.217 alicek106.example.com:80/echo-hostname ------------------------ You accessed to path "/" Access Server URL : http://alicek106.example.com/ Container Hostname : hostname-deployment-6b85d566c5-79dqp Container IP : 10.244.2.27 Original IP with Proxy : 10.244.2.1 Static string : / ------------------------ Flask received HTTP header : X-Forwarded-Host: alicek106.example.com X-Request-Id: bf262fc2c39e9715aa3a304392e055f1 Host: alicek106.example.com X-Real-Ip: 10.244.2.1 X-Forwarded-For: 10.244.2.1 Accept: */* X-Forwarded-Port: 80 X-Scheme: http User-Agent: curl/7.29.0 X-Forwarded-Proto: http remote_addr : 10.244.2.1 ------------------------ $ curl --resolve alicek106.example.com:80:10.20.2.218 alicek106.example.com:80/echo-hostname ------------------------ You accessed to path "/" Access Server URL : http://alicek106.example.com/ Container Hostname : hostname-deployment-6b85d566c5-r2s5l Container IP : 10.244.1.25 Original IP with Proxy : 10.244.2.1 Static string : / ------------------------ Flask received HTTP header : Host: alicek106.example.com X-Forwarded-For: 10.244.2.1 X-Forwarded-Port: 80 User-Agent: curl/7.29.0 Accept: */* X-Real-Ip: 10.244.2.1 X-Forwarded-Proto: http X-Scheme: http X-Forwarded-Host: alicek106.example.com X-Request-Id: e040f08ebb0d6d0953edc848e0f8246a remote_addr : 10.244.1.1 ------------------------ |
...