Azure

如何在 Azure 容器實例上掛載 NFS 共享

  • January 24, 2021

我已註冊 Azure Files NFSv4 預覽版,但似乎找不到在 ACI 上掛載 NFS 文件共享的方法。我嘗試了以下方法:

  1. 在 Eastus 中創建了一個具有兩個子網的虛擬網路,一個特定於 aci
  2. 將 NFS 儲存帳戶網路更改為僅允許來自上述 vnet 的連接: 圖片
  3. 使用以下 json 部署容器:
{
  "type": "Microsoft.ContainerInstance/containerGroups",
  "apiVersion": "2019-12-01",
  "location": "eastus",
  "name": "nfs-test",
  "properties": {
    "osType": "Linux",
    "containers": [
      {
        "name": "sshd",
        "properties": {
          "image": "boldidea.azurecr.io/ssh-test",
          "ports": [
            {
              "port": 22,
              "protocol": "TCP"
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5
            }
          },
          "volumeMounts": [
            {
              "mountPath": "/mnt/user-storage",
              "name": "user-storage"
            }
          ]
        }
      }
    ],
    "volumes": [
      {
        "azureFile": {
          "shareName": "ide-user-storage",
          "storageAccountKey": "(redacted)",
          "storageAccountName": "ideworkspacestoragenfs"
        },
        "name": "user-storage"
      }
    ],
    "imageRegistryCredentials": [
      {
        "server": "(redacted)",
        "username": "(redacted)",
        "password": "(redacted)"
      }
    ],
    "ipAddress": {
      "type": "Private",
      "ports": [
        {
          "port": 22,
          "protocol": "TCP"
        }
      ]
    },
    "networkProfile": {
      "id": "/subscriptions/(redacted)/resourceGroups/ideResourceGroup/providers/Microsoft.Network/networkProfiles/aci-network-profile-ide-vnet-eastus-aci"
    }
  }
}

部署掛起大約 30 分鐘,然後出現錯誤“無法掛載 Azure 文件卷”。我究竟做錯了什麼?

我通過 Azure 支持解決了這個問題,最後找到了 ACI 團隊,他們確認容器實例目前不支持 NFS。

引用自:https://serverfault.com/questions/1048118