STEP 3: AKS 설정 단계별
발행: (2025년 12월 27일 오전 09:01 GMT+9)
2 min read
원문: Dev.to
Source: Dev.to
사전 요구 사항
az version
az login
단계 1: AKS 클러스터 만들기
az aks create \
--resource-group devops-rg \
--name myAKSCluster \
--node-count 2 \
--enable-addons monitoring \
--generate-ssh-keys
단계 2: AKS를 ACR에 연결하기
az aks update \
--resource-group devops-rg \
--name myAKSCluster \
--attach-acr
단계 3: kubectl용 AKS 자격 증명 가져오기
az aks get-credentials \
--resource-group devops-rg \
--name myAKSCluster
단계 4: 연결 확인
kubectl get nodes
단계 5: 네임스페이스 확인
kubectl get namespaces
단계 6 (선택 사항): 자동 스케일링 활성화
az aks update \
--resource-group devops-rg \
--name myAKSCluster \
--enable-cluster-autoscaler \
--min-count 1 \
--max-count 5
단계 7: 배포 생성
kubectl create deployment myapp --image=myapp
단계 8: 배포 이미지 업데이트 및 재시작
배포를 편집하여 ACR 로그인 서버 이미지를 사용하도록 설정합니다. 예:
# In the deployment spec, set:
image: .azurecr.io/myapp:latest
그런 다음 배포를 재시작합니다:
kubectl rollout restart deployment myapp
파드 확인:
kubectl get pods
단계 9: 배포 노출
kubectl expose deployment myapp \
--port=80 \
--target-port=3000 \
--type=LoadBalancer
단계 10: 서비스 가져오기
kubectl get service myapp
단계 11: 브라우저에서 테스트
웹 브라우저를 열고 myapp 서비스의 외부 IP 주소로 이동합니다.