我可以使用flocker用于kubernetes体积吗?

时间:2015-11-13 03:04:01

标签: kubernetes

Kubernetes量支持flocker?如果支持flocker音量,举一个关于使用flocker音量的例子?谢谢!

2 个答案:

答案 0 :(得分:3)

Kubernetes 1.1版支持Flocker。可以从PersistentVolume或直接从Pod卷引用Flocker数据集。

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

答案 1 :(得分:1)

请确保你的kubernetes组件是v 1.1双重检查你的kubelet!

以下是使用Flocker集成的示例pod / rc规范

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

您需要通过flocker命令行工具提前创建卷。

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

- node是运行时收到的flocker分配的节点ID(例如下面)-s is size

$ flockerctl list-nodes
SERVER     ADDRESS
583b0093   10.0.0.109
170606f4   10.0.0.108