我正在设置Azure文件共享到pod。
- 创建命名空间
- 创建了指定的秘密
- 荚配置
apiVersion: v1
kind: Pod
metadata:
name: test-storage-pod
namespace: storage-test
spec:
containers:
- image: nginx:latest
name: test-storage-pod
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
volumeMounts:
- name: azure
mountPath: /mnt/azure-filestore
volumes:
- name: azure
azureFile:
secretName: azure-storage-secret
shareName: appdata/data
readOnly: false
kubectl describe -n storage-test pod/<pod-name>
或kubectl get -n storage-test event
LAST SEEN TYPE REASON OBJECT MESSAGE
2m13s Normal Scheduled pod/test-storage-pod Successfully assigned storage-test/test-storage-pod to aks-default-1231523-vmss00001a
6s Warning FailedMount pod/test-storage-pod MountVolume.SetUp failed for volume "azure" : Couldn't get secret default/azure-storage-secret
11s Warning FailedMount pod/test-storage-pod Unable to attach or mount volumes: unmounted volumes=[azure], unattached volumes=[default-token-gzxk8 azure]: timed out waiting for the condition
问题:
- secret也是在名称空间storage-test下创建的,Kubelet是否首先检查默认名称空间下的存储?
可能您正在使用默认名称空间,这就是Kubelet首先检查默认名称空间的原因。请尝试使用命令切换到您创建的命名空间:
kubens储存试验
尝试再次在storage-test命名空间下运行pod。