Azure CLI 환경 구성[필수 X]
- Azure Login
az login
- 리소스 프로바이더 활성화
az provider register -n Microsoft.Network az provider register -n Microsoft.Storage az provider register -n Microsoft.Compute az provider register -n Microsoft.ContainerService
- Tip az결과창 출력형식 수정
PS D:\GIT> az configure Welcome to the Azure CLI! This command will guide you through logging in and setting some default values. Your settings can be found at C:\Users\MZC01-MINSEO_KIM89\.azure\config Your current configuration is as follows: [cloud] name = AzureCloud Do you wish to change your settings? (y/N): y What default output format would you like? [1] json - JSON formatted output that most closely matches API responses. [2] jsonc - Colored JSON formatted output that most closely matches API responses. [3] table - Human-readable output format. [4] tsv - Tab- and Newline-delimited. Great for GREP, AWK, etc. [5] yaml - YAML formatted output. An alternative to JSON. Great for configuration files. [6] yamlc - Colored YAML formatted output. An alternative to JSON. Great for configuration files. [7] none - No output, except for errors and warnings. Please enter a choice [Default choice(1)]: 3 Would you like to enable logging to file? (y/N): y Microsoft would like to collect anonymous Azure CLI usage data to improve our CLI. Participation is voluntary and when you choose to participate, your device automatically sends information to Microsoft about how you use Azure CLI. To update your choice, run "az configure" again. Select y to enable data collection. (Y/n): y CLI object cache time-to-live (TTL) in minutes [Default: 10]: 10 You're all set! Here are some commands to try: $ az login $ az vm create --help $ az feedback
Azure Container Registry
(1) 레지스트리 작성
ex) ACR_NAME=sampleACRRegistry
ACR_NAME=kmsacrregistry
(2) 해당 레지스트리명이 사용가능한지 확인
ex) az acr check-name -n sample
az acr check-name -n kmsACR
- result 화면
minseo_kim89 [ ~ ]$ az acr check-name -n kmsACR { "message": null, "nameAvailable": true, "reason": null } minseo_kim89 [ ~ ]$
(3) 리소스 그룹명 설정
ACR_RES_GROUP=$ACR_NAME
(4) 리소스 그룹 작성
az group create --resource-group $ACR_RES_GROUP --location koreacentral
- result 화면
{
"id": "/subscriptions/ade73f1a-8f29-49ca-8e29-08e5a51bcd61/resourceGroups/kmsACRRegistry",
"location": "koreacentral",
"managedBy": null,
"name": "kmsACRRegistry",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
(5) ARC 레지스트리 작성
az acr create --resource-group $ACR_RES_GROUP --name $ACR_NAME --sku Standard --location koreacentral
(6) 샘플코드 다운
git clone https://github.com/torumakabe/Understanding-K8s.git
(7) photo-view 이미지 빌드
az acr build --registry $ACR_NAME --image photo-view:v1.0 v1.0/
az acr build --registry $ACR_NAME --image photo-view:v1.0 Understanding-K8s/chap02/v1.0/
- 명령어 구조
- 이미지명 : photo-view
- 디렉토리 위치 : v1.0/, Understanding-K8s/chap02/v1.0/
- v1.0파일이 있는 위치에서 명령어 실행하거나 경로 수정 필요
- Result 화면
minseo_kim89 [ ~ ]$ az acr build --registry $ACR_NAME --image photo-view:v1.0 v1.0/ 'v1.0/' doesn't exist. minseo_kim89 [ ~ ]$ cd Understanding-K8s/ minseo_kim89 [ ~/Understanding-K8s ]$ ls chap02 chap03 chap04 chap05 chap06 chap08 chap08-12-all-in-one chap09 chap10 chap11 chap12 license pics README.md shared minseo_kim89 [ ~/Understanding-K8s ]$ cd chap02/ minseo_kim89 [ ~/Understanding-K8s/chap02 ]$ ls v1.0 v2.0 minseo_kim89 [ ~/Understanding-K8s/chap02 ]$ az acr build --registry $ACR_NAME --image photo-view:v1.0 v1.0/ Packing source code into tar to upload... Uploading archived source code from '/tmp/build_archive_c193a4c8f1bd4540a77f32740abec02c.tar.gz'... Sending context (325.976 KiB) to registry: kmsacrregistry... Queued a build with ID: de1 Waiting for an agent... ~ 중략 ~ - image: registry: kmsacrregistry.azurecr.io repository: photo-view tag: v1.0 digest: sha256:90de725ec9a11138800c65d2d0103cc96aeac9761450abc73f56a8cb5f86a266 runtime-dependency: registry: registry.hub.docker.com repository: library/python tag: "3.6" digest: sha256:f8652afaf88c25f0d22354d547d892591067aa4026a7fa9a6819df9f300af6fc git: {} Run ID: de1 was successful after 1m24s
(8) photo-view v2 이미지 빌드
az acr build --registry $ACR_NAME --image photo-view:v2.0 v2.0/
az acr build --registry $ACR_NAME --image photo-view:v2.0 Understanding-K8s/chap02/v2.0/
- Result 화면
minseo_kim89 [ ~ ]$ az acr build --registry $ACR_NAME --image photo-view:v2.0 Understanding-K8s/chap02/v2.0/ Packing source code into tar to upload... Uploading archived source code from '/tmp/build_archive_adfb482d43954282aa2638aba32cfa2f.tar.gz'... Sending context (326.109 KiB) to registry: kmsacrregistry... Queued a build with ID: de3 Waiting for an agent... ~ 중략 ~ - image: registry: kmsacrregistry.azurecr.io repository: photo-view tag: v2.0 digest: sha256:dd3dd827e5bbffba628b484d5070427ba177164736b12784e3371301616e259c runtime-dependency: registry: registry.hub.docker.com repository: library/python tag: "3.6" digest: sha256:f8652afaf88c25f0d22354d547d892591067aa4026a7fa9a6819df9f300af6fc git: {} Run ID: de3 was successful after 48s
(9) 이미지 확인
az acr repository show-tags -n $ACR_NAME --repository photo-view
- Result 화면
minseo_kim89 [ ~ ]$ az acr repository show-tags -n $ACR_NAME --repository photo-view [ "v1.0", "v2.0" ]
END
작성중
Azure Kubernetes Services
- 현재 노드 수 확인
kubectl get nodes
배포순서
1. 매니패스트라고 불리는 yaml파일 작성
code tutorial-deployment.yaml
code tutorial-service.yaml
2. Kubernetes상에서 작성한 yaml파일 실행
- 작성한 매니패스트를 클러스터로 보내는 작업
kubectl apply -f tutorial-deployment.yaml
kubectl apply -f tutorial-service.yaml
3. POD 확인
kubectl get pod -o wide
4. Access Address 확인
kubectl get svc