Can I using flocker for kubernetes volume?

11/13/2015

Kubernetes volume support flocker? If support flocker volume, give an example about using flocker volume? Thanks!

-- ttyyll
kubernetes

2 Answers

11/16/2015

Flocker is supported in Kubernetes release 1.1. A Flocker dataset can be referenced from a PersistentVolume or directly from a Pod volume.

http://kubernetes.io/v1.1/examples/flocker/ http://kubernetes.io/v1.1/docs/api-reference/v1/definitions.html#_v1_persistentvolume

-- briangrant
Source: StackOverflow

1/13/2016

please make sure your kubernetes components are v 1.1 double check your kubelet!

Here is a example pod/rc spec using the Flocker integration

apiVersion: v1
kind: Service
metadata:
  name: flocker-ghost
  labels:
    app: flocker-ghost
spec:
  ports:
    # the port that this service should serve on
  - port: 80
    targetPort: 80
  selector:
    app: flocker-ghost
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: flocker-ghost
  # these labels can be applied automatically
  # from the labels in the pod template if not set
  labels:
    purpose: demo
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: flocker-ghost
    spec:
      containers:
      - name: flocker-ghost
        image: ghost:0.7.1
        env:
        - name: GET_HOSTS_FROM
          value: dns
        ports:
        - containerPort: 2368
          hostPort: 80
          protocol: TCP
        volumeMounts:
          - name: ghost-data
            mountPath: "/var/lib/ghost"
      volumes:
        - name: ghost-data
          flocker:
            datasetName: myuniqueflockerdatasetname

you need to create the volume ahead of time via flocker command line tool.

$flockerctl create -m name=myuniqueflockerdatasetname -s 10G --node=583b0093

--node is the flocker assigned node id you receive when running (example below) -s is size

$ flockerctl list-nodes
SERVER     ADDRESS
583b0093   10.0.0.109
170606f4   10.0.0.108
-- Stephen Nguyen
Source: StackOverflow