列舉後端組態選項與範例Azure NetApp Files
瞭解 Azure NetApp Files 的 NFS 和 SMB 後端組態選項、並檢閱組態範例。
後端組態選項
Trident 使用您的後端設定(子網路、虛擬網路、服務等級和位置)在要求的位置可用的容量池上建立 Azure NetApp Files Volume,並符合要求的服務等級和子網路。
Azure NetApp Files 後端提供這些組態選項。
| 參數 | 說明 | 預設 |
|---|---|---|
「分度」 |
後端配置版本。 |
永遠為1 |
「torageDriverName」 |
儲存驅動程式名稱 |
「Azure - NetApp-Files」 |
「後端名稱」 |
儲存後端的自訂名稱 |
驅動程式名稱+「_」+隨機字元 |
《訂閱ID》 |
Azure訂閱的訂閱ID |
|
「TenantId」 |
應用程式註冊的租戶ID |
|
"clientID" |
應用程式註冊的用戶端ID |
|
「客戶機密」 |
應用程式註冊的用戶端機密 |
|
《服務層級》 |
其中一種是「標準」、「高級」或「超高」 |
""(隨機) |
位置 |
要建立新磁碟區的Azure位置名稱 |
|
"來源群組" |
用於篩選已探索資源的資源群組清單 |
「[]」(無篩選器) |
《netappAccounts》 |
篩選探索資源的NetApp帳戶清單 |
「[]」(無篩選器) |
《容量Pools》 |
用於篩選已探索資源的容量集區清單 |
「[]」(無篩選器、隨機) |
「虛擬化網路」 |
具有委派子網路的虛擬網路名稱 |
" |
《Subnet》 |
委派給「icrosoft.Netapp/volumes`」的子網路名稱 |
" |
《網路功能》 |
磁碟區的 VNet 功能集,可以是 |
" |
「nfsMountOptions」 |
對 NFS 掛載選項進行精細控制。SMB 卷將忽略此設定。若要使用 NFS 版本 4.1 掛載卷,請在以逗號分隔的掛載選項清單中新增 |
"nfsves=3" |
《限制Volume大小》 |
如果要求的磁碟區大小高於此值、則資源配置失敗 |
""(預設不強制執行) |
「DebugTraceFlags」 |
疑難排解時要使用的偵錯旗標。範例:「\{"API":假、「方法」:真、「探索」:true}。除非您正在進行疑難排解並需要詳細的記錄傾印、否則請勿使用此功能。 |
null |
|
設定NFS或SMB磁碟區建立。選項包括 |
|
|
代表此後端所支援的區域和區域清單。如需詳細資訊、請 "使用「csi拓撲」"參閱。 |
|
|
表示 QoS 類型:自動或手動。 |
汽車 |
|
設定允許的最大吞吐量,單位為 MiB/秒。僅支援手動 QoS 容量池。 |
|
|
|
如需網路功能的詳細資訊、請參閱 "設定Azure NetApp Files 適用於某個聲音量的網路功能"。 |
考慮 Azure 雲端環境(26.02)
從 26.02 版本開始, Trident 支援在多個 Azure 雲端環境中建立和管理 Azure NetApp Files 後端。
支援的 Azure 雲端包括:
-
Azure 商業版
-
Azure Government(Azure Government / MAG)
部署 Trident 或建立 Azure NetApp Files 後端時、請確保 Azure Resource Manager 和驗證端點與您的 Azure 雲端環境相符。如果端點不相符、 `tridentctl`就無法驗證、後端建立也會失敗。
必要的權限與資源
如果在建立 PVC 時收到「未找到容量池」錯誤,則可能是您的應用程式註冊缺少所需的權限和資源(子網路、虛擬網路、容量池)。如果啟用了偵錯模式,Trident 會記錄建立後端時發現的 Azure 資源。請確認是否使用了適當的角色。
`resourceGroups`、 `netappAccounts`、 `capacityPools`、 `virtualNetwork` 和 `subnet` 的值可以使用短名稱或完全限定名稱來指定。大多數情況下建議使用完全限定名稱,因為短名稱可能會符合多個同名資源。
|
|
如果虛擬網路與Azure NetApp Files(ANF) 儲存帳戶位於不同的資源群組中,則在設定後端資源群組清單時,請為虛擬網路指定資源群組。 |
`resourceGroups`、 `netappAccounts` 和 `capacityPools` 值是過濾器,用於將發現的資源集限制為此儲存後端可用的資源,並且可以以任意組合指定。完全限定名稱遵循以下格式:
| 類型 | 格式 |
|---|---|
資源群組 |
<資源群組> |
NetApp帳戶 |
資源群組//<NetApp帳戶> |
容量資源池 |
資源群組//<NetApp帳戶>/<容量資源池> |
虛擬網路 |
資源群組//<虛擬網路> |
子網路 |
資源群組//<虛擬網路>/<子網路> |
Volume資源配置
您可以透過在設定檔特定部分中指定以下選項來控制預設磁碟區配置。如需詳細資訊,請參閱 組態範例。
| 參數 | 說明 | 預設 |
|---|---|---|
「匯出規則」 |
匯出新磁碟區的規則。 |
「0.00.0.0/0」 |
「napshotDir |
存取「.snapshot」目錄 |
|
《大小》 |
新磁碟區的預設大小 |
100公克 |
「unixPermissions」 |
新磁碟區的UNIX權限(4個八進位數字)。SMB磁碟區已忽略。 |
""(預覽功能、訂閱時需要白名單) |
組態範例
以下範例展示了基本配置,其中大多數參數都保留預設值。這是定義後端最簡單的方法。
最小組態
這是絕對最小的後端組態。使用此配置, Trident 會發現您所有的 NetApp 帳戶、容量集區和子網路(已委派給位於已設定位置的 Azure NetApp Files ),並隨機將新磁碟區放置在其中一個集區和子網路上。由於 `nasType`被省略, `nfs`預設值會套用,後端將會佈建 NFS 磁碟區。
當您剛開始使用 Azure NetApp Files 並試用時、這項組態是理想的選擇、但實際上您會想要為您所配置的磁碟區提供額外的範圍。
---
apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
name: backend-tbc-anf-1
namespace: trident
spec:
version: 1
storageDriverName: azure-netapp-files
subscriptionID: 9f87c765-4774-fake-ae98-a721add45451
tenantID: 68e4f836-edc1-fake-bff9-b2d865ee56cf
clientID: dd043f63-bf8e-fake-8076-8de91e5713aa
clientSecret: SECRET
location: eastus
管理的身分識別
此後端組態已不再如此 subscriptionID、 tenantID、 clientID`和 `clientSecret,使用託管身分識別時為選用功能。
apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
name: backend-tbc-anf-1
namespace: trident
spec:
version: 1
storageDriverName: azure-netapp-files
capacityPools:
- resource-group-1/netapp-account-1/ultra-pool
resourceGroups:
- resource-group-1
netappAccounts:
- resource-group-1/netapp-account-1
virtualNetwork: resource-group-1/eastus-prod-vnet
subnet: resource-group-1/eastus-prod-vnet/eastus-anf-subnet
雲端身分識別
此後端組態已不再如此 tenantID、 clientID`和 `clientSecret(使用雲端身分識別時為選用功能)。
apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
name: backend-tbc-anf-1
namespace: trident
spec:
version: 1
storageDriverName: azure-netapp-files
capacityPools:
- ultra-pool
resourceGroups:
- aks-ami-eastus-rg
netappAccounts:
- smb-na
virtualNetwork: eastus-prod-vnet
subnet: eastus-anf-subnet
location: eastus
subscriptionID: 9f87c765-4774-fake-ae98-a721add45451
具有容量集區篩選器的特定服務層級組態
此後端組態會將磁碟區放置在 Azure 的 `eastus`位置中的 `Ultra`容量集區。Trident 會自動探索該位置中委派給 Azure NetApp Files 的所有子網路,並隨機將新磁碟區放置在其中一個子網路上。
---
version: 1
storageDriverName: azure-netapp-files
subscriptionID: 9f87c765-4774-fake-ae98-a721add45451
tenantID: 68e4f836-edc1-fake-bff9-b2d865ee56cf
clientID: dd043f63-bf8e-fake-8076-8de91e5713aa
clientSecret: SECRET
location: eastus
serviceLevel: Ultra
capacityPools:
- application-group-1/account-1/ultra-1
- application-group-1/account-1/ultra-2
具有手動 QoS 容量池的後端範例
此後端配置將磁碟區放置在 Azure 中 `eastus`具有手動 QoS 容量池的位置。
---
version: 1
storageDriverName: azure-netapp-files
backendName: anf1
location: eastus
labels:
clusterName: test-cluster-1
cloud: anf
nasType: nfs
defaults:
qosType: Manual
storage:
- serviceLevel: Ultra
labels:
performance: gold
defaults:
maxThroughput: 10
- serviceLevel: Premium
labels:
performance: silver
defaults:
maxThroughput: 5
- serviceLevel: Standard
labels:
performance: bronze
defaults:
maxThroughput: 3
進階組態
此後端組態可進一步將磁碟區放置範圍縮小至單一子網路、並修改部分Volume資源配置預設值。
---
version: 1
storageDriverName: azure-netapp-files
subscriptionID: 9f87c765-4774-fake-ae98-a721add45451
tenantID: 68e4f836-edc1-fake-bff9-b2d865ee56cf
clientID: dd043f63-bf8e-fake-8076-8de91e5713aa
clientSecret: SECRET
location: eastus
serviceLevel: Ultra
capacityPools:
- application-group-1/account-1/ultra-1
- application-group-1/account-1/ultra-2
virtualNetwork: application-group-1/eastus-prod-vnet
subnet: application-group-1/eastus-prod-vnet/my-subnet
networkFeatures: Standard
nfsMountOptions: vers=3,proto=tcp,timeo=600
limitVolumeSize: 500Gi
defaults:
exportRule: 10.0.0.0/24,10.0.1.0/24,10.0.2.100
snapshotDir: "true"
size: 200Gi
unixPermissions: "0777"
虛擬集區組態
此後端配置在單一檔案中定義了多個儲存池。當您有多個容量池支援不同的服務級別,並且希望在 Kubernetes 中建立代表這些容量池的儲存類別時,此配置非常有用。虛擬池標籤用於根據 `performance`來區分這些池。
---
version: 1
storageDriverName: azure-netapp-files
subscriptionID: 9f87c765-4774-fake-ae98-a721add45451
tenantID: 68e4f836-edc1-fake-bff9-b2d865ee56cf
clientID: dd043f63-bf8e-fake-8076-8de91e5713aa
clientSecret: SECRET
location: eastus
resourceGroups:
- application-group-1
networkFeatures: Basic
nfsMountOptions: vers=3,proto=tcp,timeo=600
labels:
cloud: azure
storage:
- labels:
performance: gold
serviceLevel: Ultra
capacityPools:
- application-group-1/netapp-account-1/ultra-1
- application-group-1/netapp-account-1/ultra-2
networkFeatures: Standard
- labels:
performance: silver
serviceLevel: Premium
capacityPools:
- application-group-1/netapp-account-1/premium-1
- labels:
performance: bronze
serviceLevel: Standard
capacityPools:
- application-group-1/netapp-account-1/standard-1
- application-group-1/netapp-account-1/standard-2
支援的拓撲組態
Trident 能夠根據區域和可用區為工作負載配置磁碟區。 `supportedTopologies`此後端配置中的程式碼區塊用於為每個後端提供區域和可用區清單。此處指定的區域和可用區值必須與每個 Kubernetes 叢集節點標籤中的區域和可用區值相符。這些區域和可用區代表儲存類別中可以提供的允許值清單。對於包含後端提供的區域和可用區子集的儲存類, Trident 會在指定的區域和可用區中建立磁碟區。如需更多資訊,請參閱"使用「csi拓撲」"。
---
version: 1
storageDriverName: azure-netapp-files
subscriptionID: 9f87c765-4774-fake-ae98-a721add45451
tenantID: 68e4f836-edc1-fake-bff9-b2d865ee56cf
clientID: dd043f63-bf8e-fake-8076-8de91e5713aa
clientSecret: SECRET
location: eastus
serviceLevel: Ultra
capacityPools:
- application-group-1/account-1/ultra-1
- application-group-1/account-1/ultra-2
supportedTopologies:
- topology.kubernetes.io/region: eastus
topology.kubernetes.io/zone: eastus-1
- topology.kubernetes.io/region: eastus
topology.kubernetes.io/zone: eastus-2
儲存類別定義
以下內容 StorageClass 定義請參閱上述儲存資源池。
使用的範例定義 parameter.selector 欄位
使用 `parameter.selector`您可以為每個 `StorageClass`指定用於託管磁碟區的虛擬池。此磁碟區將具有所選儲存池中定義的設定項。
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gold
provisioner: csi.trident.netapp.io
parameters:
selector: performance=gold
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: silver
provisioner: csi.trident.netapp.io
parameters:
selector: performance=silver
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: bronze
provisioner: csi.trident.netapp.io
parameters:
selector: performance=bronze
allowVolumeExpansion: true
SMB磁碟區的定義範例
使用 nasType、 node-stage-secret-name`和 `node-stage-secret-namespace,您可以指定 SMB 磁碟區並提供所需的 Active Directory 憑證。
預設命名空間的基本組態
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: anf-sc-smb
provisioner: csi.trident.netapp.io
parameters:
backendType: "azure-netapp-files"
trident.netapp.io/nasType: "smb"
csi.storage.k8s.io/node-stage-secret-name: "smbcreds"
csi.storage.k8s.io/node-stage-secret-namespace: "default"
每個命名空間使用不同的機密
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: anf-sc-smb
provisioner: csi.trident.netapp.io
parameters:
backendType: "azure-netapp-files"
trident.netapp.io/nasType: "smb"
csi.storage.k8s.io/node-stage-secret-name: "smbcreds"
csi.storage.k8s.io/node-stage-secret-namespace: ${pvc.namespace}
每個磁碟區使用不同的機密
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: anf-sc-smb
provisioner: csi.trident.netapp.io
parameters:
backendType: "azure-netapp-files"
trident.netapp.io/nasType: "smb"
csi.storage.k8s.io/node-stage-secret-name: ${pvc.name}
csi.storage.k8s.io/node-stage-secret-namespace: ${pvc.namespace}
|
|
nasType: smb 篩選支援 SMB 磁碟區的儲存池。nasType: nfs 或 nasType: null 篩選 NFS 儲存池。
|
建立後端
建立後端組態檔之後、請執行下列命令:
tridentctl create backend -f <backend-file>
如果您使用的是非商業版 Azure 雲端,請確保 `tridentctl`已將其設定為使用 Azure Resource Manager 和 Azure 雲端環境的驗證端點。如果後端建立失敗,請檢查後端組態並檢視記錄以判斷原因:
tridentctl logs
識別並修正組態檔的問題之後、您可以再次執行create命令。