MrE
MrE

Reputation: 20808

How to use the cinder plugin in Kubernetes

Using Kubernetes on bare metal and trying to figure out how to mount a external bloc storage volume from an OpenStack cloud provider.

I understand I need to use the Cinder plugin. https://github.com/kubernetes/kubernetes/tree/master/pkg/volume/cinder

I modified an example I found to build a test pod, the volume is simply defined as the following, in the pod definition:

apiVersion: v1
kind: Pod
metadata:
  name: test
  labels:
    name: test
spec:
  containers:
    - image: busybox
      name: busybox
      command:
      - "sleep"
      - "3600"
      volumeMounts:
        - name: persistent-storage
          mountPath: /var/lib/storage
  volumes:
    - name: persistent-storage
      cinder:
        volumeID: bd82f7e2-wece-4c01-a505-4acf60b07f4a
        fsType: ext4

I have a volumeID I got from the OpenStack volume API.

I put it there, but I am not sure the volume is actually being mounted:

I am not sure how to check actually, but I would guess that df -h would show a remote volume being mounted on the host and in the container, but I don't see any.

I would think Kubernetes would send me an error if the volume was not mounted, the pod would fail or something... but it runs.

So, the question is: how do I verify the volume is mounted? and as I believe it is not mounted, what should I do to make this cinder plugin work?

Upvotes: 1

Views: 1913

Answers (1)

MrE
MrE

Reputation: 20808

The conclusion of my search on this was that the nodes using the block storage also need to be on the same OpenStack cluster.

That is, it is not (easily/standard) possible to mount Cinder block storage into a cluster of nodes that is not on the Open Stack cluster.

See: Kubernetes: using OpenStack Cinder from one cloud provider while nodes on another

Upvotes: 0

Related Questions