gpt4 book ai didi

azure - 将 azureVhd 附加到 kubernetes pod 时出错

转载 作者:行者123 更新时间:2023-12-03 03:11:50 27 4
gpt4 key购买 nike

我在将 azureVhd 附加到 kubernetes pod 时遇到以下错误。

error validating "dev-dev-mongo-rc.yaml": error validating data: found invalid field azureVhd for v1.Volume; if you choose to ignore these errors, turn validation off with --validate=false

kubernetes 版本:$ kubectl 版本

Client Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.2", GitCommit:"3085895b8a70a3d985e9320a098e74f545546171", GitTreeState:"clean"} Server Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.2", GitCommit:"3085895b8a70a3d985e9320a098e74f545546171", GitTreeState:"clean"}

replicationController-rc.yaml

kind: "ReplicationController"
apiVersion: "v1"
metadata:
name: "test"
spec:
replicas: 1
selector:
name: "test"
template:
metadata:
labels:
name: "test"
spec:
volumes:
-
name: "mongo-disk"
azureVhd:
vhdUrl: "https://portalvhds1459021060022.blob.core.windows.net/vhd-store/stable-mongo-01.vhd"
fsType: "ext4"
readOnly: false
containers:
-
name: "mongo"
image: "docker.io/mongo:3.2"
resources:
limits:
cpu: "0.2"
memory: "0.5Gi"
ports:
-
containerPort: 27017
protocol: "TCP"
resources: {}
volumeMounts:
-
name: "mongo-disk"
mountPath: "/data/db"
imagePullPolicy: "IfNotPresent"
restartPolicy: "Always"

最佳答案

您可以在此处找到完整的 k8s azure 磁盘挂载示例: https://github.com/andyzhangx/Demo/tree/master/linux/azuredisk

azure disk Static Provisioning 的 yaml 配置如下:

apiVersion: v1
kind: Pod
metadata:
name: nginx-azuredisk
spec:
containers:
- image: nginx
name: nginx-azuredisk
volumeMounts:
- name: azure
mountPath: /mnt/disk
volumes:
- name: azure
azureDisk:
diskName: test.vhd
diskURI: https://YOURSTORAGEACCOUNT.blob.core.windows.net/vhds/test.vhd

关于azure - 将 azureVhd 附加到 kubernetes pod 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36427566/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com