본문 바로가기
🌴 DevOps/Docker & K8s

쿠버네티스 ingress 구성 (2/3) - ingress / Nginx-Controller 생성

by 카프리썬_ 2020. 5. 24.
728x90

서비스Type 복습하기 

 

ingress(ingress-nginx)구성 목적

하나의 아이피에 각각의 도메인마다 각자의 서비스를 구성하고 싶을때 

https://teamsmiley.github.io/2019/01/27/kubernetes-ingress/

 

 

현재 상태 : AWS위에서 사용하는 노드를 생성한 쿠버네티스

Pod는 없고, 서비스는 kops로 생성한거 하나 있음

근데 서비스는 내부끼리 통신할 수 있는 ip를 가지고있음 (타입 : clusterip)

 

 

ingress 규칙 생성

1) yaml파일 생성 : vim ingres-controller.yaml

host : 가비아에서 구입한 host명
path : 백엔드랑 연결할 path

backend/ServiceName : 연결할 서비스명

backedn/ServicePort : 연결할 서비스의 포트

2) yaml파일 배포 :  kubectl apply -f ingress-controller.yaml

3) ingress 생성 확인 :kubectl get ingress

4) ingress 세부설정 확인 : kubectl describe ingress test-ingress

*아직 ingress-controller를 설치하지 않은 상태이기 때문에, yaml을 정의했다고 서비스가 바뀌지 않음

 

nginx-ingress controller 설치 ->오류

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

 

원인 : AWS를 사용하고 구성하고 있기 때문에 NLB가 필요함

 

따라서 현재 public Cloud를 끼고 구성하기 때문에 서비스의 타입을 Loadbalancer로 바꿔야함 

그리고 NLB 뒤에 nginx-controller를 설치할 수 있음

 

 

 

https://kubernetes.github.io/ingress-nginx/deploy/#aws

 

Installation Guide - NGINX Ingress Controller

Installation Guide Attention The default configuration watches Ingress object from all the namespaces. To change this behavior use the flag --watch-namespace to limit the scope to a particular namespace. Warning If multiple Ingresses define paths for the s

kubernetes.github.io

 

 

반응형