이번 글에서는 지난 글에서 가상머신 2개로 구성한 Kubernetes 클러스터에, 공식 Manifest를 사용하여 Kubeflow 최신버전을 배포해 보겠습니다.
진행 순서
# [Control Node]
$ sudo apt install -y nfs-kernel-server
$ sudo mkdir /srv/nfs-volume
$ echo "/srv/nfs-volume *(rw,insecure,sync,no_subtree_check,no_root_squash)" | sudo tee /etc/exports
## 출력값 -> /srv/nfs-volume *(rw,sync,no_subtree_check,no_root_squash)
$ sudo systemctl restart nfs-kernel-server.service
# [Worker Node]
$ sudo apt install -y nfs-common
$ git clone https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
$ cd ~/nfs-subdir-external-provisioner/deploy/
$ vim deployment.yaml
# deployment.yaml
...
containers:
...
env:
- name: PROVISIONER_NAME
value: k8s-sigs.io/nfs-subdir-external-provisioner
- name: NFS_SERVER
value: 192.168.56.101 # NFS서버 주소
- name: NFS_PATH
value: /srv/nfs-volume # 마운팅할 경로
volumes:
- name: nfs-client-root
nfs:
server: 192.168.56.101 # NFS서버 주소
path: /srv/nfs-volume # 마운팅할 경로
...
# 배포 진행
$ kubectl create -k .
# default StorageClass 설정
$ kubectl patch storageclasses.storage.k8s.io nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
# default StorageClass 설정 확인
$ kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
nfs-client (default) k8s-sigs.io/nfs-subdir-external-provisioner Delete Immediate false 19s
$ curl -s "https://raw.githubusercontent.com/\
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
$ sudo mv kustomize /usr/local/bin
$ kustomize version
v5.1.
$ git clone https://github.com/kubeflow/manifests.git
$ cd manifests
$ while ! kustomize build example | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 10; done
$ kubectl get po -n kubeflow
NAME READY STATUS RESTARTS AGE
admission-webhook-deployment-6cf44ffbdb-v6hzb 1/1 Running 0 2m13s
cache-server-65b7b58f99-mkfbj 0/2 PodInitializing 0 2m13s
centraldashboard-657df77fc7-8ftrp 1/2 Running 0 2m13s
kubeflow-pipelines-profile-controller-59ccbd47b9-w942d 1/1 Running 0 2m13s
metadata-envoy-deployment-6448d544f5-kmm2d 1/1 Running 0 2m13s
metadata-grpc-deployment-784b8b5fb4-fw7lv 0/2 PodInitializing 0 2m13s
metadata-writer-76d6d85b4b-rt68m 0/2 PodInitializing 0 2m13s
workflow-controller-f65c9d9b4-8cfp8 0/2 PodInitializing 0 2m13s
...
$ kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
authservice ClusterIP 10.233.24.91 <none> 8080/TCP 3m49s
cluster-local-gateway ClusterIP 10.233.25.89 <none> 15020/TCP,80/TCP 3m49s
istio-ingressgateway ClusterIP 10.233.27.33 <none> 15021/TCP,80/TCP,443/TCP 3m49s
istiod ClusterIP 10.233.42.154 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 3m49s
knative-local-gateway ClusterIP 10.233.9.57 <none> 80/TCP 3m49s
$ kubectl edit -n istio-system svc istio-ingressgateway
...
spec:
clusterIP: 10.233.27.33
clusterIPs:
- 10.233.27.33
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: status-port
port: 15021
protocol: TCP
targetPort: 15021
- name: http2
port: 80
protocol: TCP
targetPort: 8080
nodePort: 31380 # 이부분 추가
- name: https
port: 443
protocol: TCP
targetPort: 8443
selector:
app: istio-ingressgateway
istio: ingressgateway
sessionAffinity: None
type: NodePort # 이 부분 변경
...
수정이 완료되면 호스트 환경에서 Control Node IP + 포트번호를 입력하여 Kubeflow UI 환경으로 접속 할 수 있습니다.
기본 계정은 user@example.com, 패스워드는 12341234 입니다.
접속하면 Kubeflow UI의 대시보드를 확인할 수 있습니다.
이렇게 공식 Manifest를 사용하면 Kubeflow 최신 버전을 손쉽게 배포할 수 있습니다. 다음 글에서는 Kubeflow 리소스 중 하나인 Jupyter Notebook 서버를 사용해 보겠습니다.