Azure 添加allowVolumeExpansion:true到AKS中的默认存储类

Azure 添加allowVolumeExpansion:true到AKS中的默认存储类,azure,azure-storage,azure-aks,Azure,Azure Storage,Azure Aks,报告说: 这些默认存储类不允许您在创建卷后更新卷大小。要启用此功能,请将allowVolumeExpansion:true行添加到默认存储类之一,或者创建您自己的自定义存储类。可以使用kubectl edit sc命令编辑现有存储类。有关存储类和创建自己的存储类的更多信息,请参阅AKS中应用程序的存储选项 我尝试过在Kubernetes仪表板中编辑默认值YAML(看起来像JSON而不是YAML): { "kind": "StorageClass", "apiVersion": "stor

报告说:

这些默认存储类不允许您在创建卷后更新卷大小。要启用此功能,请将
allowVolumeExpansion:true
行添加到默认存储类之一,或者创建您自己的自定义存储类。可以使用
kubectl edit sc
命令编辑现有存储类。有关存储类和创建自己的存储类的更多信息,请参阅AKS中应用程序的存储选项

我尝试过在Kubernetes仪表板中编辑
默认值
YAML(看起来像JSON而不是YAML):

{
  "kind": "StorageClass",
  "apiVersion": "storage.k8s.io/v1",
  "metadata": {
    "name": "default",
    "selfLink": "/apis/storage.k8s.io/v1/storageclasses/default",
    "uid": "<uid>",
    "resourceVersion": "3891497",
    "creationTimestamp": "2020-02-14T01:34:03Z",
    "labels": {
      "kubernetes.io/cluster-service": "true"
    },
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"storage.k8s.io/v1beta1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{\"storageclass.beta.kubernetes.io/is-default-class\":\"true\"},\"labels\":{\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"default\"},\"parameters\":{\"cachingmode\":\"ReadOnly\",\"kind\":\"Managed\",\"storageaccounttype\":\"Standard_LRS\"},\"provisioner\":\"kubernetes.io/azure-disk\"}\n",
      "storageclass.beta.kubernetes.io/is-default-class": "true"
    }
  },
  "provisioner": "kubernetes.io/azure-disk",
  "parameters": {
    "cachingmode": "ReadOnly",
    "kind": "Managed",
    "storageaccounttype": "Standard_LRS"
  },
  "reclaimPolicy": "Delete",
  "volumeBindingMode": "Immediate",
  "allowVolumeExpansion": "true"
}
此外:

还使用
kubectl edit sc
尝试了以下所有操作:

$ kubectl edit sc default allowVolumeExpansion: true          
Error from server (NotFound): storageclasses.storage.k8s.io "allowVolumeExpansion:" not found
Error from server (NotFound): storageclasses.storage.k8s.io "true" not found

$ kubectl edit sc default "allowVolumeExpansion: true"
Error from server (NotFound): storageclasses.storage.k8s.io "allowVolumeExpansion: true" not found

$ kubectl edit sc/default allowVolumeExpansion: true
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'

$ kubectl edit sc/default "allowVolumeExpansion: true"
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'
$kubectl编辑sc默认允许卷扩展:true
服务器错误(未找到):storageclasses.storage.k8s.io“allowVolumeExpansion:”未找到
服务器错误(未找到):未找到storageclasses.storage.k8s.io“true”
$kubectl编辑sc默认值“allowVolumeExpansion:true”
服务器错误(未找到):未找到storageclasses.storage.k8s.io“allowVolumeExpansion:true”
$kubectl编辑sc/默认允许卷扩展:true
错误:以资源/名称形式传递参数时,无需将资源类型指定为单独的参数(例如,“kubectl get resource/”而不是“kubectl get resource/”)
$kubectl编辑sc/默认值“allowVolumeExpansion:true”
错误:以资源/名称形式传递参数时,无需将资源类型指定为单独的参数(例如,“kubectl get resource/”而不是“kubectl get resource/”)

实现这一点的正确方法是什么?如果文档中有一个示例,这会很有帮助。

我不符合您遇到的问题。
allowVolumeExpansion
是存储类的属性,而不是参数,它需要布尔值。您可以在中看到它

我认为您设置它的值时出错。在我的测试中,我在YAML文件中添加了如下属性:

allowVolumeExpansion: true
不是

allowVolumeExpansion: "true"
因此,我认为您需要将这一行更改为:

"allowVolumeExpansion": true

我没有遇到您遇到的问题。
allowVolumeExpansion
是存储类的属性,而不是参数,它需要布尔值。您可以在中看到它

我认为您设置它的值时出错。在我的测试中,我在YAML文件中添加了如下属性:

allowVolumeExpansion: true
不是

allowVolumeExpansion: "true"
因此,我认为您需要将这一行更改为:

"allowVolumeExpansion": true

还有问题吗?它解决了你的问题吗?如果有,请接受。如果没有,请给出答复。这个问题有任何更新吗?我没有看到任何东西,解决了问题还是没有。还有问题吗?它解决了你的问题吗?如果有,请接受。如果没有,请给出答复。这个问题有任何更新吗?我没有看到任何东西,解决了问题还是没有ot.非常奇怪。我很确定我以前通过仪表板尝试过,但遇到了错误。这次成功了。非常奇怪。我很确定我之前通过仪表板尝试过,但遇到了错误。这次成功了。