본문 바로가기

Docker & Kubenetes

MLOps를 위한 EKS 클러스터 구축 - 2 (with. Kubeflow)

구축 프로세스

1. EKS 생성

2. EKS에 접근하기 위한 EC2 생성

3. EKS Cluster에 접근하기 위한 IAM을 생성하고 Role을 부여

4. EKS Cluster에 접근하기 위한 Kubectl, AWS CLI 등을 EC2에 설치 후 접근 확인

5. EKS에 Kubeflow 설치

 

본 포스팅은 5번부터 진행됩니다. 1~4번은 아래 포스팅을 참고 바랍니다.

MLOps를 위한 EKS 클러스터 구축 - 1 (with. Kubeflow)

 

MLOps를 위한 EKS 클러스터 구축 - 1 (with. Kubeflow)

본 포스팅은 MLOps 환경을 위해 EKS에 Kubeflow를 설치하기 위한 과정은 담았습니다. 구축 프로세스 1. EKS 생성 2. EKS에 접근하기 위한 EC2 생성 3. EKS Cluster에 접근하기 위한 IAM을 생성하고 Role을 부여 4.

crongblog.tistory.com


Kubeflow 설치하기

1. Git Repository 다운로드

export KUBEFLOW_RELEASE_VERSION=v1.7.0
export AWS_RELEASE_VERSION=v1.7.0-aws-b1.0.3
git clone https://github.com/awslabs/kubeflow-manifests.git && cd kubeflow-manifests
git checkout ${AWS_RELEASE_VERSION}
git clone --branch ${KUBEFLOW_RELEASE_VERSION} https://github.com/kubeflow/manifests.git upstrea

# 릴리즈 버전 확인 : https://awslabs.github.io/kubeflow-manifests/docs/about/releases/

2. Install necessary tools

sudo apt update
sudo apt upgrade
 
sudo apt-get install jq
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install python3.8
 
python3.8 --version
alias python=python3.8
 
sudo apt install python3.8-dbg python3.8-dev python3.8-venv python3.8-distutils python3.8-lib2to3 python3.8-
gdbm python3.8-tk python3.8-full
 
make install-tools

3. AWS Credentials 설정 (필요 시)

aws configure --profile=kubeflow
# AWS Access Key ID [None]: <enter access key id>
# AWS Secret Access Key [None]: <enter secret access key>
# Default region name [None]: <AWS region>
# Default output format [None]: json
# Set the AWS_PROFILE variable with the profile above
export AWS_PROFILE=kubeflow

4. Terraform 배포

cd deployments/vanilla/terraform
 
# environment variables
# Region to create the cluster in
export CLUSTER_REGION=ap-northeast2
# Name of the cluster to create
export CLUSTER_NAME=kubeflow-eks
 
# Save the variables to a .tfvars file
cat <<EOF > sample.auto.tfvars
cluster_name="${CLUSTER_NAME}"
cluster_region="${CLUSTER_REGION}"
EOF
 
# View a preview
terraform init && terraform plan
 
# Apply
make deploy
 
# ----------------------------------------
# Clean
make delete

5. Coonect Kubeflow Dashboard

#kubeflow-manifests 위치에서 명령어 실행
make port-forward

#  http://localhost:8080/ Kubeflow Web 접근 가능

# 초기 접속 ID : user@example.com
# 초기 접속 PW : 12341234

6. PW 변경 방법

# PW 변경 방법
upstream/common/dex/base/config-map.yaml
#파일에서 staticPasswords 부분에 있는 hash값 변경
...
  staticPasswords:
  - email: user@example.com
    hash: <enter the generated hash here>

Troubleshooting

 

# kubeflow 대시보드 접속 시, 검은 바탕과 함께 다음과 같은 에러 발생
CSRF check failed. This may happen if you opened the login form in more than 1 tabs. Please try to login again.
 
# Kubeflow에서 사용하는 web은 Secure cookies를 사용하는데 HTTPS 통신을 하지 않으면 일부 기능을 사용하는데 있어 에러가 발생하기에 Secure cookies 기능을 해제함
# 프로덕션 레벨에서는 권장하지 않고 HTTPS 통신을 활성화 하는 것을 권장함
# HTTPS 활성화 방법 :https://junwork123.tistory.com/44
 
k edit deploy jupyter-web-app-deployment -n kubeflow
 
# APP_SECURE_COOKIES를 false로 수정
spec:
      containers:
      - env:
        - name: APP_SECURE_COOKIES
          values: "false"

'Docker & Kubenetes' 카테고리의 다른 글

Kubernetes Service  (0) 2024.05.14
MLOps를 위한 EKS 클러스터 구축 - 1 (with. Kubeflow)  (0) 2024.04.19
Deployments 와 StatefulSets  (0) 2024.04.17
Kubernetes - Cluster Node 제거  (1) 2024.02.01
Kubernetes - Static Pod  (0) 2024.01.12