티스토리 뷰

MLOps

Kubeflow Expose

문타리 2025. 3. 14.

🤦‍♂️ 실제 프로젝트에서는 MetalLB 가 많이 사용되지만 클라우드 VM 환경에선 지원하지 않음
https://metallb.universe.tf/installation/clouds/

실제 프로젝트에서 물리 L4 장비를 Ingress Controller 와 연결해서 Kubernetes 상의 서비스를 노출하기도 함
😉 실제 L4 장비는 없으니 실습에서는 HAProxy 설치하기로 함!!

HAProxy Install & Config

mkdir -p /root/files/packages/haproxy
dnf download --resolve --destdir=/root/files/packages/haproxy --arch=x86_64 haproxy
dnf localinstall -y --disablerepo=\* /root/files/packages/haproxy/*.rpm

systemctl start haproxy
systemctl enable haproxy
systemctl status haproxy --no-pager
 
 
tee /etc/haproxy/haproxy.cfg <<- HAPROXY_CONFIG
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    log         /dev/log    local0   debug
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
 
#---------------------------------------------------------------------
# Default settings
#---------------------------------------------------------------------
defaults
    mode                    tcp                                    # 인스턴스가 처리할 프로토콜
    log                     global
    option                  tcplog                                 # TCP 로그 포맷 사용
    option                  dontlognull                            # null connection(health check용 connection)에 대한 로깅 활성화
    timeout connect         10s
    timeout client          30s                                    # client와의 연결 최대 유지 시간
    timeout server          30s                                    # server와의 연결 최대 유지 시간
 
#---------------------------------------------------------------------
# Frontend configuration for HTTP
#---------------------------------------------------------------------
frontend http_front
    bind *:80
    default_backend http_back
 
#---------------------------------------------------------------------
# Backend configuration for HTTP
#---------------------------------------------------------------------
backend http_back
    balance roundrobin
    server web1 127.0.0.1:31001 check
HAPROXY_CONFIG
 
echo "local0.*    /var/log/haproxy.log" | sudo tee /etc/rsyslog.d/10-haproxy.conf
systemctl restart rsyslog

systemctl restart haproxy
systemctl status haproxy --no-pager

Nginx Ingress Controller Install

mkdir -p /root/files/ingress
curl -L https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.3/deploy/static/provider/baremetal/deploy.yaml -o /root/files/ingress/ingress-nginx-deploy.yaml
 
sed -i '/^    targetPort: http$/a \    nodePort: 31001' /root/files/ingress/ingress-nginx-deploy.yaml
sed -i '/^    targetPort: https$/a \    nodePort: 31002' /root/files/ingress/ingress-nginx-deploy.yaml
 
kubectl apply -f /root/files/ingress/ingress-nginx-deploy.yaml
kubectl get svc -n ingress-nginx
sleep 40;

🤷‍♂️ Istio Ingress Gateway를 바로 사용하면 되는데 굳이 Ingress Controller를 앞에 배치한 이유

  • Kubeflow에서 Istio는 여러 컴포넌트(notebook, pipeline, Katib, KServe 등)의 앞단에서 인증을 통합적으로 처리하지만 Support System(Keycloak, Object Storage, Portal 등)들은 자체 인증 체계를 갖추고 있음 👉 Support System 은 인증을 위해 Istio가 따로 필요없음
  • 실제 프로젝트 환경에서 Support System 들은 인프라 자원 및 도메인도 다른 완전 별도의 시스템일 확률이 높음
  • 실습 환경은 하나의 클러스터를 공유하지만 별도 구성이라는 컨셉을 살리기 위해 아래와 같은 네트워크 흐름을 설계함
    Kubeflow : Ingress Controller > Ingress > Istio Ingress Gateway > Gateway > Virtual Service > Service
    Support System : Ingress Controller > Ingress > Service

Kubeflow Ingress 설정

cat <<EOF | tee ~/kf-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kf-ingress
  namespace: istio-system
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /  # 요청 경로를 리다이렉트
    nginx.ingress.kubernetes.io/proxy-body-size: "1gb"    
spec:
  ingressClassName: "nginx"  # NGINX Ingress Controller 사용
  rules:
  - http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: istio-ingressgateway
            port:
              number: 80
EOF
kubectl apply -f ~/kf-ingress.yaml

http://<PUBLIC-IP> 로 접근하면 kubeflow 로그인 화면 확인 가능

'MLOps' 카테고리의 다른 글

Keycloak Install (with. Helm)  (0) 2025.03.17
Kubeflow SSL Config  (0) 2025.03.17
Kubeflow Install (v1.9.1)  (0) 2025.03.14
Kubeflow Install in Kind Cluster  (1) 2025.03.14
Nvidia Device Plugin Install  (0) 2025.03.14
댓글