01. AKS 따라하기 - 컨테이너와 클러스터 만들기
시작하기 앞서서… 예제 코드 가져오기
1
| git clone https://github.com/Azure-Samples/aks-store-demo.git
|
- 해당 디렉토리의 yaml 파일을 사용해 RabbitMQ 이미지를 다운로드 하고 시작한다.
1
| docker compose -f docker-compose-quickstart.yml up -d
|
이미지가 잘 들어졌는지 확인하고 실행중인 컨테이너를 보기
1
2
3
4
5
| docker images
...
docker ps
|
로컬 테스트
접속하여 샘플 어플리케이션을 로드 한다.
도커를 중지하기 위해선
Azure 세팅
- Azure CLI 설치
*brew install azure-cli
를 통해 설치*az version
을 통해 Azure CLI의 설치를 확인 할 수 있다.
- Azure 구독 관리
- Microsoft에 로그인 해 Azure 포털을 통해 구독을 신청한다.
Azure Container Registry
- ACR 인스턴즈를 만들이 전 리소스 그룹이 필요하다.
az login
을 통해 접속한다.
- 리소스 그룹 만들기
1
| az group create --name myResourceGroup --location eastus
|
- ACR 인스턴스를 만들고 고유 레지스트리 이름 정하기
1
| az acr create --resource-group myResourceGroup --name kimkyuheongregistry --sku Basic
|
- 컨테이너 이미지 빌드해서 레지스트리에 푸쉬하기
1
2
3
| az acr build --registry kimkyuheongregistry --image aks-store-demo/product-service:latest ./src/product-service/
az acr build --registry kimkyuheongregistry --image aks-store-demo/order-service:latest ./src/order-service/
az acr build --registry kimkyuheongregistry --image aks-store-demo/store-front:latest ./src/store-front/
|
1
| az acr build --registry kimkyuheongregistry --image aks-store-demo/product-service:latest ./src/product-service/
|
az acr build
--registry kimkyuheongregistry
- 이미지 빌드 및 저장할 ACR 이름 지정
- Push 작업을 하는 부분
--image aks-store-demo/product-service
--image
빌드된 docker 이미지의 이름과 태그 지정- 일반적으로 사용되는
latest
버전을 나타낸다. - Tag를 하는 부분
/src/product-service
이슈 - 인증 관련
1
2
3
4
| (TasksOperationsNotAllowed) ACR Tasks requests for the registry kimkyuheongregistry and f216bf69-53a0-4119-a948-4c37d5818ac5 are not permitted. Please file an Azure support request at http://aka.ms/azuresupport for assistance.
Code: TasksOperationsNotAllowed
Message: ACR Tasks requests for the registry kimkyuheongregistry and f216bf69-53a0-4119-a948-4c37d5818ac5 are not permitted. Please file an Azure support request at http://aka.ms/azuresupport for assistance.
Target: request
|
- 인증 값 관련 이슈 발생
- 평가판 관련 구독과 관련의 이슈..?
- 아래의 사이트를 참조해 다른 명령어로 push 작업 실행해 해결
https://learn.microsoft.com/en-us/answers/questions/1530524/how-to-fix-(tasksoperationsnotallowed)-acr-tasks-r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| # 1. Azure에 로그인
az login
# 2. ACR에 로그인
az acr login --name kimkyuheongregistry
#product-service 이미지 빌드 및 푸시
## 3. Docker 이미지 빌드
docker build -t aks-store-demo/product-service:latest ./src/product-service/
## 4. Docker 이미지 태그 지정
docker tag aks-store-demo/product-service:latest kimkyuheongregistry.azurecr.io/aks-store-demo/product-service:latest
## 5. Docker 이미지 푸시
docker push kimkyuheongregistry.azurecr.io/aks-store-demo/product-service:latest
# order-service 이미지 빌드 및 푸시
## 3. Docker 이미지 빌드
docker build -t aks-store-demo/order-service:latest ./src/order-service/
## 4. Docker 이미지 태그 지정
docker tag aks-store-demo/order-service:latest kimkyuheongregistry.azurecr.io/aks-store-demo/order-service:latest
## 5. Docker 이미지 푸시
docker push kimkyuheongregistry.azurecr.io/aks-store-demo/order-service:latest
# store-front 이미지 빌드 및 푸시
## 3. Docker 이미지 빌드
docker build -t aks-store-demo/store-front:latest ./src/store-front/
## 4. Docker 이미지 태그 지정
docker tag aks-store-demo/store-front:latest kimkyuheongregistry.azurecr.io/aks-store-demo/store-front:latest
## 5. Docker 이미지 푸시
docker push kimkyuheongregistry.azurecr.io/aks-store-demo/store-front:latest
|