Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
minLevel1
maxLevel6
outlinefalse
typelist
printablefalse

Azure SA 업무환경 설정

Azure VM 생성 - Windows 11

구독, 리소스 그룹을 선택 및 입력한다.

...

ACR에 대한 AKS 관리 ID Role 부여 현황을 확인한다.

...

AKS 클러스터 검증

# Define variables
AKS_Name="osd2023KORzeroaksdemo"
ACR_Name="osd2023KORzeroacrdemo"
RG_Name="RG-OSD2023-AKSDemo"

# Get AKS credentials
az aks get-credentials -g $RG_Name -n $AKS_Name

# Get Node Info
kubectl get node

Application 배포 및 검증

ACR 이미지 등록

별도 터미널 창을 열어 이미지 태그 및 푸시

# Docker tag and Push to ACR
docker tag appmod-contapp osd2023zeroacrdemo.azurecr.io/appmod-contapp:latest
az acr login -n osd2023zeroacrdemo
docker push osd2023zeroacrdemo.azurecr.io/appmod-contapp:latest

Code Block
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

새로운 크로스 플랫폼 PowerShell 사용 https://aka.ms/pscore6

PS C:\Users\zerobig> docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
PS C:\Users\zerobig> docker images
REPOSITORY                              TAG       IMAGE ID       CREATED      SIZE
appmod-contapp                          latest    8629e2fcf972   4 days ago   121MB
zeroacrdemo.azurecr.io/ap               latest    8629e2fcf972   4 days ago   121MB
zeroacrdemo.azurecr.io/appmod-contapp   latest    8629e2fcf972   4 days ago   121MB
zeroacrtf.azurecr.io/appmod-contapp     latest    8629e2fcf972   4 days ago   121MB
PS C:\Users\zerobig> docker tag appmod-contapp osd2023zeroacrdemo.azurecr.io/appmod-contapp:latest
PS C:\Users\zerobig> az acr login -n osd2023zeroacrdemo
Login Succeeded
PS C:\Users\zerobig> docker push osd2023zeroacrdemo.azurecr.io/appmod-contapp:latest
The push refers to repository [osd2023zeroacrdemo.azurecr.io/appmod-contapp]
7374f8b571a9: Pushed
ceaf9e1ebef5: Pushed
9b9b7f3d56a0: Pushed
f1b5933fe4b5: Pushed
latest: digest: sha256:ddf9994cb1630255c2fcec8b60617811ca751e59aaf7bcc99677028cd43f78c1 size: 1159
PS C:\Users\zerobig>

YAML Manifest 구성

Code Block
apiVersion: apps/v1
kind: Deployment
metadata:
  name: zeroaksdemo
spec:
  replicas: 2
  selector:
    matchLabels:
      app: zero-aks-app
  template:
    metadata:
      labels:
        app: zero-aks-app
    spec:
      containers:
        - name: zero-aks-demo
          image: zeroacrtf.azurecr.io/web:latest
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
    name: zero-aks-app
spec:
  ports:
    - name: http-port
      port: 80
      targetPort: 8080
  selector:
    app: zero-aks-app
  type: LoadBalancer

YAML Manifest 배포 및 결과 검증

Code Block
zerobig@ZEROBIG-NT800:/mnt/d/2023_Azure/HandsOn/Terraform$ kubectl apply -f contapp-deploy-svc.yaml 
deployment.apps/zeroaksdemo created
service/zero-aks-app created
zerobig@ZEROBIG-NT800:/mnt/d/2023_Azure/HandsOn/Terraform$ kubectl get pod --watch
NAME                           READY   STATUS    RESTARTS   AGE
zeroaksdemo-5874694c78-2k6zk   1/1     Running   0          7s
zeroaksdemo-5874694c78-4xrbt   1/1     Running   0          7s
^Czerobig@ZEROBIG-NT800:/mnt/d/2023_Azure/HandsOn/Terraform$ kubectl get svc
NAME           TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)        AGE
kubernetes     ClusterIP      10.0.0.1       <none>          443/TCP        17m
zero-aks-app   LoadBalancer   10.0.104.234   20.214.218.34   80:30193/TCP   3m2s
zerobig@ZEROBIG-NT800:/mnt/d/2023_Azure/HandsOn/Terraform$