# 1. create volume
# az disk create \
#   --resource-group k8s \
#   --name k8s-static-vol  \
#   --size-gb 1 \
#   --query id --output tsv

# 2. create pod using the manfest below using azure disk as volume
# 3. exec into the container created 
# enter mongodb commnad - mongo   명령어로 클라이언트 실행. 
# use mystore 로 실행 
#  insert db record to db
#  db.foo.insert({name: 'foo'})  실행
#  db.foo.find() 명령으로 생성된 레코드 확인
# 4. 생성한 pod  삭젝후 팟 재성성후 레코드 존재 확인 


---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: azure-vol-deploy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azure-vol
  template:
    metadata:
      labels:
        app: azure-vol 
    spec:
      containers:
      - name: web
        image: mongo
        volumeMounts:
        - name: mongodb-data
          mountPath: /data/db
      volumes:
        - name: mongodb-data
          azureDisk:
            kind: Managed
            diskName: k8s-static-vol
            diskURI: "/subscriptions/69978730-9bb4-48d3-b7a6-dc6fabe747d4/resourceGroups/k8s/providers/Microsoft.Compute/disks/k8s-static-vol"