Ingress Controller 설치

2025. 2. 2. 10:31·🔹Kubernetes
728x90
SMALL

[전제 조건]

✔ Calico 정상 실행 상태

kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

✔ 실행 여부 확인

kubectl get pods -n kube-system | grep calico

✔ 출력 (Running 상태여야 함)

calico-kube-controllers-658d97c59c-krt5p   1/1     Running   0          112s
calico-node-6sbmz                          1/1     Running   0          112s
calico-node-gsn8s                          1/1     Running   0          112s
calico-node-hwcsl                          1/1     Running   0          112s

[절차]

1️⃣ Ingress Controller(Nginx) 설치
2️⃣ Nginx Deployment & Service 배포 (/var/www/html 데이터 마운트)
3️⃣ Ingress 리소스 생성 (mywebsite.local)


✅ (1) Ingress Controller 설치 (Nginx)

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/baremetal/deploy.yaml

✔ 설치 확인

kubectl get ns

✔ 출력 (Active상태여야 함)

NAME              STATUS   AGE
default           Active   56m
ingress-nginx     Active   43s #이녀석
kube-node-lease   Active   56m
kube-public       Active   56m
kube-system       Active   56m

✔ Ingress 서비스 확인 (LoadBalancer 또는 NodePort)

kubectl get svc -n ingress-nginx

✔ 출력

NAME                                 TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller             LoadBalancer   10.108.40.215   <none>        80:31018/TCP,443:32354/TCP   8m26s
ingress-nginx-controller-admission   ClusterIP      10.108.206.98   <none>        443/TCP                      8m26s

👉 Portforwarding 되어 있는 것 확인 가능

- http -> 31018 port 이용

- https -> 32354 port 이용


✅ (2) Nginx 서비스 생성 (ClusterIP)

📌 파일명: nginx-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: ClusterIP

📌 적용 명령어

kubectl apply -f nginx-service.yaml

✔ 서비스 확인

kubectl get svc -o wide

👉 서비스가 nginx-service로 정상적으로 생성


✅ (3) Ingress 리소스 생성 (HTTP 요청을 Nginx로 연결)

📌 파일명: nginx-ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
  - host: master
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx-service
            port:
              number: 80

📌 적용 명령어

kubectl apply -f nginx-ingress.yaml

✔ Ingress 확인

kubectl get ingress

✔ 출력 예시

NAME            CLASS    HOSTS             ADDRESS   PORTS   AGE
nginx-ingress   <none>   master            192.168.98.162       80      41s

👉 http://192.168.98.162:80 도메인을 Ingress로 연결.

LIST

'🔹Kubernetes' 카테고리의 다른 글

kubernetes Service vs Ingress 비교  (0) 2025.02.02
MetalLB 설치 (Bare Metal 환경에서 LoadBalancer 사용 가능하게 설정) 및 External IP 설정  (0) 2025.02.02
Kubernetes 설정 파일 제거  (0) 2025.02.01
Service 정의  (0) 2025.01.27
Pod 정의  (0) 2025.01.27
'🔹Kubernetes' 카테고리의 다른 글
  • kubernetes Service vs Ingress 비교
  • MetalLB 설치 (Bare Metal 환경에서 LoadBalancer 사용 가능하게 설정) 및 External IP 설정
  • Kubernetes 설정 파일 제거
  • Service 정의
terranbin
terranbin
Studying Computer Science
  • terranbin
    Engineer
    terranbin
  • 전체
    오늘
    어제
    • 분류 전체보기 (129)
      • ☁️Cloud (42)
        • AWS (38)
        • MS Azure (4)
      • 🐳 Infra (1)
        • System (12)
        • DRBD (3)
      • 🔌Network (8)
      • 🔹Storage (8)
      • 🔹Kubernetes (15)
      • 🔹 DevOps (8)
      • 🔹Study (4)
      • 🔹Install (6)
      • 🔹ETC (2)
      • 🔹PostMan (6)
      • 🔹Openstack (3)
      • 🔹RcloneView (6)
      • 🔹Test (0)
      • 🔹Debug (2)
      • 🔹DBMS (2)
  • 블로그 메뉴

    • 홈
  • 링크

    • sungbin
    • Github
  • 공지사항

  • 인기 글

  • 태그

    설치
    rocky9
    EC2
    Google Drive
    terraform
    centos7
    kubernetes
    network
    distributed load testing
    EBS
    ceph
    SAA
    S3
    rcloneview
    postman
    OpenStack
    rocky8
    kubectl
    aws dlt
    AWS
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
terranbin
Ingress Controller 설치
상단으로

티스토리툴바