无法在群集范围内的 API 组 "storage.k8s.io" 中获取资源 "storageclasses"
cannot get resource "storageclasses" in API group "storage.k8s.io" at the cluster scope
我正在尝试使用存储类、PersistentVolumeClaim、PersistentVolume
我可以 运行 通过来自本地的命令 promt 并且工作正常
但是当通过 azure pipeline 部署时出现问题
“无法在群集范围内的 API 组“storage.k8s.io”中获取资源“storageclasses”
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: azurefile
provisioner: kubernetes.io/azure-file
mountOptions:
- dir_mode=0777
- file_mode=0777
parameters:
storageAccount: xxxdevxxx
location: Souxxxxst xxxxx
---
# Create a Secret to hold the name and key of the Storage Account
# Remember: values are base64 encoded
apiVersion: v1
kind: Secret
metadata:
name: azurefile-secret
type: Opaque
data:
azurestorageaccountname: YWlhZ7xxxxxzdA==
azurestorageaccountkey: a2s4bURfghfhjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMUd6eE1UTEdxZHdRUzhvR09UZ0xBempPN3dXZEF0K1E9PQ==
---
# Create a persistent volume, with the corresponding StorageClass and the reference to the Azure File secret.
# Remember: Create the share in the storage account otherwise the pods will fail with a "No such file or directory"
apiVersion: v1
kind: PersistentVolume
metadata:
name: jee-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
storageClassName: azurefile
azureFile:
secretName: azurefile-secret
shareName: jee-log
readOnly: false
mountOptions:
- dir_mode=0777
- file_mode=0777
- uid=1000
- gid=1000
---
# Create a PersistentVolumeClaim referencing the StorageClass and the volume
# Remember: this is a static scenario. The volume was created in the previous step.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jee-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: azurefile-xxxx
volumeName: jee-pv
在 Azurepipeline 中通过 Kubernetes 创建持久卷和存储 class
使用 服务连接类型 = Azure 资源管理器 而不是 Azure 服务连接
我正在尝试使用存储类、PersistentVolumeClaim、PersistentVolume 我可以 运行 通过来自本地的命令 promt 并且工作正常 但是当通过 azure pipeline 部署时出现问题 “无法在群集范围内的 API 组“storage.k8s.io”中获取资源“storageclasses”
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: azurefile
provisioner: kubernetes.io/azure-file
mountOptions:
- dir_mode=0777
- file_mode=0777
parameters:
storageAccount: xxxdevxxx
location: Souxxxxst xxxxx
---
# Create a Secret to hold the name and key of the Storage Account
# Remember: values are base64 encoded
apiVersion: v1
kind: Secret
metadata:
name: azurefile-secret
type: Opaque
data:
azurestorageaccountname: YWlhZ7xxxxxzdA==
azurestorageaccountkey: a2s4bURfghfhjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMUd6eE1UTEdxZHdRUzhvR09UZ0xBempPN3dXZEF0K1E9PQ==
---
# Create a persistent volume, with the corresponding StorageClass and the reference to the Azure File secret.
# Remember: Create the share in the storage account otherwise the pods will fail with a "No such file or directory"
apiVersion: v1
kind: PersistentVolume
metadata:
name: jee-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
storageClassName: azurefile
azureFile:
secretName: azurefile-secret
shareName: jee-log
readOnly: false
mountOptions:
- dir_mode=0777
- file_mode=0777
- uid=1000
- gid=1000
---
# Create a PersistentVolumeClaim referencing the StorageClass and the volume
# Remember: this is a static scenario. The volume was created in the previous step.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jee-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: azurefile-xxxx
volumeName: jee-pv
在 Azurepipeline 中通过 Kubernetes 创建持久卷和存储 class 使用 服务连接类型 = Azure 资源管理器 而不是 Azure 服务连接