[英]How to mount a volume with a windows container in kubernetes?
i'm trying to mount a persistent volume into my windows container, but i alwys get this error:我正在尝试将持久卷安装到我的 Windows 容器中,但我总是收到此错误:
Unable to mount volumes for pod "mssql-with-pv-deployment-3263067711-xw3mx_default(....)": timeout expired waiting for volumes to attach/mount for pod "default"/"mssql-with-pv-deployment-3263067711-xw3mx". list of unattached/unmounted volumes=[blobdisk01]
i've created a github gist with the console output of "get events" and "describe sc | pvc | po" maybe someone will find the solution with it.我已经创建了一个github gist ,其中包含“get events”和“describe sc | pvc | po”的控制台输出,也许有人会找到解决方案。
Below are my scripts that I'm using for deployment.下面是我用于部署的脚本。
my storageclass:我的存储类:
kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: azure-disk-sc provisioner: kubernetes.io/azure-disk parameters: skuname: Standard_LRS
my PersistentVolumeClaim:我的 PersistentVolumeClaim:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: azure-disk-pvc spec: storageClassName: azure-disk-sc accessModes: - ReadWriteOnce resources: requests: storage: 20Gi
and the deployment of my container:以及我的容器的部署:
apiVersion: apps/v1beta1 kind: Deployment metadata: name: mssql-with-pv-deployment spec: replicas: 1 template: metadata: labels: app: mssql-with-pv spec: nodeSelector: beta.kubernetes.io/os: windows terminationGracePeriodSeconds: 10 containers: - name: mssql-with-pv image: testacr.azurecr.io/sql/mssql-server-windows-developer ports: - containerPort: 1433 env: - name: ACCEPT_EULA value: "Y" - name: SA_PASSWORD valueFrom: secretKeyRef: name: mssql key: SA_PASSWORD volumeMounts: - mountPath: "c:/volume" name: blobdisk01 volumes: - name: blobdisk01 persistentVolumeClaim: claimName: azure-disk-pvc --- apiVersion: v1 kind: Service metadata: name: mssql-with-pv-deployment spec: selector: app: mssql-with-pv ports: - protocol: TCP port: 1433 targetPort: 1433 type: LoadBalancer
what am i doing wrong?我究竟做错了什么? is there another way to mount a volume?
还有另一种方法来安装卷吗?
thank for every help :)感谢每一个帮助:)
I would try:我会尝试:
kubectl get events
to see you if have a more detailed error (I could figure out the reason when I used NFS watching events) kubectl get events
看看你是否有更详细的错误(当我使用 NFS 监视事件时,我可以找出原因)You will need a new volume in D: drive, looks like folders in C: are not supported for Windows Containers, see here:您将需要 D: 驱动器中的新卷,看起来 Windows 容器不支持 C: 中的文件夹,请参见此处:
https://github.com/kubernetes/kubernetes/issues/65060 https://github.com/kubernetes/kubernetes/issues/65060
Demos: https://github.com/andyzhangx/demo/tree/master/windows/azuredisk演示: https : //github.com/andyzhangx/demo/tree/master/windows/azuredisk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.