将azureVhd附加到kubernetes pod时出错

时间:2016-04-05 13:19:09

标签: azure kubernetes

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

  

错误验证“dev-dev-mongo-rc.yaml”:错误验证数据:找到   v1.Volume的无效字段azureVhd;如果你选择忽略这些   错误,请使用--validate = false

关闭验证

kubernetes版本: $ kubectl版本

  

客户端版本:version.Info {Major:“1”,   轻微:“1”,GitVersion:“v1.1.2”,   GitCommit: “3085895b8a70a3d985e9320a098e74f545546171”   GitTreeState:“clean”}服务器版本:version.Info {Major:“1”,   轻微:“1”,GitVersion:“v1.1.2”,   GitCommit: “3085895b8a70a3d985e9320a098e74f545546171”   GitTreeState: “干净”}

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"

1 个答案:

答案 0 :(得分:1)

您可以在此处找到完整的k8s天蓝色磁盘安装示例: https://github.com/andyzhangx/Demo/tree/master/linux/azuredisk

天蓝色盘的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