쿠버네티스 Ingress Controller 설치(rancher-desktop)

이현우·2022년 4월 29일
1

쿠버네티스

목록 보기
5/11

랜처 데스크탑 NGINX Ingress Controller 설치 안내 페이지

환경

  • wsl (ununtu-20.04)
  • rancher-desktop 1.2.1

1. 설치 방법

1.1 Helm을 이용한 NGINX 수신 컨트롤러 배포

$ helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace

1.2 kubectl을 통한 NGINX 수신 컨트롤러 배보

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.2/deploy/static/provider/cloud/deploy.yaml

2. MetalLB 설치

ingress-nginx-controller는
Public Cloud 환경 (AWS, GCP, Azure)인 경우 해당 Cloud의 LoadBalancer와 연동되고
On-Premise 환경의 경우 MetalLB Addon의 LoadBalancer 와 연동이 된다

On-Premise란
기업의 서버를 클라우드 같은 원격 환경에서 운영하는 방식이 아닌,
자체적으로 보유한 전산실 서버에 직접 설치해 운영하는 방식
Private Cloud와 동일한 뜻
  • Ingress 요청을 처리하기 위한 Service Object는 일반적으로 클라우드 플랫폼에서 제공되는 Load Balancer 타입의 Service를 사용.
  • 하지만 On-Premise환경(Private Cloud)에서 운영하고 있는 서버에 Ingress를 직접 구축하게 된다면,
    Service의 Type으로서 NodePort, ExternalIP, 또는 kubernetes Addon 종류 중에 하나인 MetalLB 등을 대신 사용할 수 있음

설치 참고 사이트
https://cla9.tistory.com/94

3. 확인

3.1 pods 실행 확인

$ kuvectl get pods -n ingress-nginx

3.2 샘플 배포 및 연결된 서비스 생성

$ kubectl create deployment demo --image=nginx --port=80
$ kubectl expose deployment demo

3.3 인그레스 리소스 생성

$ kubectl create ingress demo-localhost --class=nginx --rule="demo.localdev.me/*=demo:80"

http://demo.localdev.me/ 에 접속 하면 NGINX Welcome 페이지가 보이면 끝

4. treafik 이슈

  • 개인적으로 minio, harbor, gitlab을 ingress로 적용하는 과정에서 404 not found 에러로 라우팅이 인식이 제대로 안되는 것 같았다.

4.1 Type을 확인하자

ingress-controller의 타입이 NodePort로 되어있었다. 어차피 로드밸런서를 사용해줄 생각이었기에 타입변경을 해주었다.

4.2 serviece와 pod를 확인하자

kube-system의 namespace에서 treafik이라는 필요 없는 로드밸런서가 이미 존재하고 있었기에 삭제 처리 해주었다.

profile
GitHub - https://github.com/jenu8628

1개의 댓글

comment-user-thumbnail
2022년 7월 19일

오 꿀팁 갑사합니다!!

답글 달기