본문 바로가기
Cloud/Azure

AKS(Azure Kubernetes Service) 3Tire - 1

by 팡팡마트 2023. 11. 6.
728x90

 

- VM으로 Docker 이미지 생성 후 ACR에 Push

- VM으로 AKS 노드 접속 후 ACR의 이미지를 Pull하여 Web, Was의 Pod 배포

- web1, web2는 Ingress로 HTTP 경로기반 라우팅

- web, was Pod는 HPA로 Autoscaling

 

1. vm 생성

Centos8stream

 

2. Azure Database for MySQL 유동 서버 생성

 

3. vm에 AzureCLI, Docker, Mysql 설치

[AzureCLI]

Microsoft 레포지토리 키 가져오기

# rpm --import https://packages.microsoft.com/keys/microsoft.asc

**Centos8s

# dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm

# yum install azure-cli

구독에 로그인

# az login

# az account set --subscription [구독id]

 

[Docker]

Docker 레포지토리 추가

# yum install yum-utils

# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Dokcer engine 설치

# yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

버전확인

# docker version

docker start

# service docker start

 

[Mysql]

MySQL 8.0 설치 (tistory.com)

 

MySQL 8.0 설치

** CentOS 8 Stream 1. mysql 다운로드 링크 확인 MySQL :: MySQL Community Edition MySQL :: MySQL Community Edition MySQL Community Edition MySQL Community Edition is the freely downloadable version of the world's most popular open source database. It

pangpangmart.tistory.com

 

4. Kubernetes 서비스 리소스 생성

가상머신에서 cli로 생성

# export RESOURE_GROUP=[리소스그룹이름]

# export CLUSTER_NAME=[aks 클러스터이름]

# export LOCATION=koreacentral

# az aks create \
    --resource-group [리소스그룹이름] \
    --name [aks 클러스터이름] \
    --node-count 2 \
    --enable-addons http_application_routing \
    --generate-ssh-keys \
    --node-vm-size Standard_B2s \
    --network-plugin azure

 

5. kubectl 설치

쿠버네티스 레포지토리 추가

# cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

# yum install -y kubectl

 

6. AKS 클러스터 연결

# az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURE_GROUP

# kubectl get nodes

 

 

**이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

728x90