1
votes

I'm getting following error which attaching azureVhd to 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 version : $ kubectl version

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"
2

2 Answers

1
votes

You could find complete k8s azure disk mount example here: https://github.com/andyzhangx/Demo/tree/master/linux/azuredisk

yaml config of azure disk Static Provisioning is as following:

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
0
votes

Azure File source is only supported and it is represented as azureFile