안녕하세요 본아에요~

 

오늘은 portal.azure.com의 vm 안에서 aks, acr등을 활용하여

 

jupyter notebook을 올리는 작업을 한번 진행해 보겠습니다.(부족한 점이 많아요)

 

1. portal azure 로그인 후, 리소스 그룹을 할당받음(리소스 그룹안에서 vm, aks, acr등이 만들어짐)

 

2. vm (ubuntu 18.04) 생성

 

3. vm 상에서 azure-cli 설치

 

 

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az login # Azure Cloud와의 연동

# 다음과 같은 문구가 뜬다.
#To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HBCHP2AY5 to authenticate.

 

해당 url로 접속 후, 인증을 진행한다.

 

4. kubectl cli 설치

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version --client

5. docker 설치

docker는 기본적으로 root계정의 권한 아래에서 진행이 되기 때문에,

usermod를 활용하여 권한을 부여한다.

sudo apt install docker.io
docker version (client만 뜨고 server는 안뜬다)
sudo usermod -a -G docker AzureUser
sudo service docker restart
docker version
exit
docker version
docker ps -a # 컨테이너 아무것도 없음

6. Azure Container Resistory 생성

# rg-intern-2020 리소스그룹 내에 acrinternjupyter 라는 acr 생성
az acr create --resource-group rg-intern-2020 --name acrinternjupyter --sku Basic

# acrinternjupyter 리소스에 로그인
az acr login --name acrinternjupyter

rg-intern-2020 리소스 그룹내의 acr list 출력해서 보기
az acr list -g rg-intern-2020 --query "[].{acrLoginServer:loginServer}" --output table

 

7. docker hub에서 jupyter/base-notebook pull 해서 가져오기(image를 가져오는 것임)

# docker hub에서 jupyter/base-notebook 이미지 가져오기
docker pull jupyter/base-notebook

# 가져온 이미지에 태그 달기
docker tag jupyter/base-notebook acrinternjupyter.azurecr.io/base-notebook:v1

# 태그 단 이미지를 푸쉬하기(푸쉬를 하면 azure container repository로 들어가게됨)
docker push acrinternjupyter.azurecr.io/base-notebook:v1

# acr list 살펴보기
az acr repository list --name acrinternjupyter --output table

8. AKS를 생성하면서 acr과 붙이기

az aks create --resource-group rg-intern-2020 --name aks-intern-jupyter --node-count 3 --generate-ssh-keys --attach-acr acrinternjupyter

# kubectl 명령어가 먹도록 만들기 ( 이것은, kubectl 명령어가 만든 aks를 바라보도록 하는 명령어이다)
az aks get-credentials --resource-group rg-intern-2020 --name aks-intern-jupyter

9. jupyter namespace 만들어서 관리하기

kubectl create namespace jupyter

mkdir jupyter
cd jupyter
touch jupyter.yaml

kubernetes에 적용할 yaml파일 작성하기(deployment, services)

 

10. kubectl 명령어로 pods 띄우기

kubectl apply -f jupyter.yaml -n jupyter
kubectl get pods -n jupyter -w
kubectl get svc -n jupyter -w

 

여기까지가 정말 기본적으로 설치 및 주피터 노트북을 빠르게 띄우는 작업을 진행해 보았습니다.

 

다음 업로드 때에는, 영구 스토리지를 연결해서 하는 작업을 진행해 보도록 하겠습니다.

 

다음 업로드 - https://bonahbruce.tistory.com/91

 

kubernetes에 jupyter notebook 띄우기 (2)

안녕하세요 보나에요~ 전에꺼에 이어서 해볼께요! (1)을 보시고 싶으면 https://bonahbruce.tistory.com/76 여기로 들어가보세요! kubernetes에 jupyter container 띄우기 ( azure 활용) 안녕하세요 본아에요~ 오..

bonahbruce.tistory.com

 

'IT > Kubernetes' 카테고리의 다른 글

helm 설치  (0) 2020.08.11
kubernetes에 jupyter notebook 띄우기 (2)  (0) 2020.08.07
kubernetes multiple cluster일때 cluster 옮기는 방법  (0) 2020.08.03
k8s 정리  (0) 2020.07.31
cloud 관련 링크  (0) 2020.07.13

+ Recent posts