From e97070d8f1bb83a924ba73d4c94240e1d47c3bf6 Mon Sep 17 00:00:00 2001 From: Zichang Lin Date: Mon, 28 Sep 2015 20:03:06 +0800 Subject: [PATCH] Update cephfs example according to config best practices --- cephfs/README.md | 10 +++++---- cephfs/cephfs-with-secret.json | 39 ---------------------------------- cephfs/cephfs-with-secret.yaml | 22 +++++++++++++++++++ cephfs/cephfs.json | 37 -------------------------------- cephfs/cephfs.yaml | 21 ++++++++++++++++++ 5 files changed, 49 insertions(+), 80 deletions(-) delete mode 100644 cephfs/cephfs-with-secret.json create mode 100644 cephfs/cephfs-with-secret.yaml delete mode 100644 cephfs/cephfs.json create mode 100644 cephfs/cephfs.yaml diff --git a/cephfs/README.md b/cephfs/README.md index b4903f1e..821add65 100644 --- a/cephfs/README.md +++ b/cephfs/README.md @@ -41,7 +41,7 @@ If you don't have a Ceph cluster, you can set up a [containerized Ceph cluster]( Then get the keyring from the Ceph cluster and copy it to */etc/ceph/keyring*. -Once you have installed Ceph and new Kubernetes, you can create a pod based on my examples [cephfs.json](cephfs.json) and [cephfs-with-secret.json](cephfs-with-secret.json). In the pod JSON, you need to provide the following information. +Once you have installed Ceph and a Kubernetes cluster, you can create a pod based on my examples [cephfs.yaml](cephfs.yaml) and [cephfs-with-secret.yaml](cephfs-with-secret.yaml). In the pod yaml, you need to provide the following information. - *monitors*: Array of Ceph monitors. - *user*: The RADOS user name. If not provided, default *admin* is used. @@ -53,11 +53,13 @@ Once you have installed Ceph and new Kubernetes, you can create a pod based on m Here are the commands: ```console + # kubectl create -f examples/cephfs/cephfs.yaml + # create a secret if you want to use Ceph secret instead of secret file - # cluster/kubectl.sh create -f examples/cephfs/secret/ceph-secret.yaml + # kubectl create -f examples/cephfs/secret/ceph-secret.yaml - # cluster/kubectl.sh create -f examples/cephfs/v1beta3/cephfs.json - # cluster/kubectl.sh get pods + # kubectl create -f examples/cephfs/cephfs-with-secret.yaml + # kubectl get pods ``` If you ssh to that machine, you can run `docker ps` to see the actual pod and `docker inspect` to see the volumes used by the container. diff --git a/cephfs/cephfs-with-secret.json b/cephfs/cephfs-with-secret.json deleted file mode 100644 index bdaefff3..00000000 --- a/cephfs/cephfs-with-secret.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "apiVersion": "v1", - "id": "cephfs2", - "kind": "Pod", - "metadata": { - "name": "cephfs2" - }, - "spec": { - "containers": [ - { - "name": "cephfs-rw", - "image": "kubernetes/pause", - "volumeMounts": [ - { - "mountPath": "/mnt/cephfs", - "name": "cephfs" - } - ] - } - ], - "volumes": [ - { - "name": "cephfs", - "cephfs": { - "monitors": [ - "10.16.154.78:6789", - "10.16.154.82:6789", - "10.16.154.83:6789" - ], - "user": "admin", - "secretRef": { - "name": "ceph-secret" - }, - "readOnly": true - } - } - ] - } -} diff --git a/cephfs/cephfs-with-secret.yaml b/cephfs/cephfs-with-secret.yaml new file mode 100644 index 00000000..c3d7a02c --- /dev/null +++ b/cephfs/cephfs-with-secret.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Pod +metadata: + name: cephfs2 +spec: + containers: + - name: cephfs-rw + image: kubernetes/pause + volumeMounts: + - mountPath: "/mnt/cephfs" + name: cephfs + volumes: + - name: cephfs + cephfs: + monitors: + - 10.16.154.78:6789 + - 10.16.154.82:6789 + - 10.16.154.83:6789 + user: admin + secretRef: + name: ceph-secret + readOnly: true diff --git a/cephfs/cephfs.json b/cephfs/cephfs.json deleted file mode 100644 index b8b5ea65..00000000 --- a/cephfs/cephfs.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "apiVersion": "v1", - "id": "cephfs", - "kind": "Pod", - "metadata": { - "name": "cephfs" - }, - "spec": { - "containers": [ - { - "name": "cephfs-rw", - "image": "kubernetes/pause", - "volumeMounts": [ - { - "mountPath": "/mnt/cephfs", - "name": "cephfs" - } - ] - } - ], - "volumes": [ - { - "name": "cephfs", - "cephfs": { - "monitors": [ - "10.16.154.78:6789", - "10.16.154.82:6789", - "10.16.154.83:6789" - ], - "user": "admin", - "secretFile": "/etc/ceph/admin.secret", - "readOnly": true - } - } - ] - } -} diff --git a/cephfs/cephfs.yaml b/cephfs/cephfs.yaml new file mode 100644 index 00000000..135979e2 --- /dev/null +++ b/cephfs/cephfs.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Pod +metadata: + name: cephfs +spec: + containers: + - name: cephfs-rw + image: kubernetes/pause + volumeMounts: + - mountPath: "/mnt/cephfs" + name: cephfs + volumes: + - name: cephfs + cephfs: + monitors: + - 10.16.154.78:6789 + - 10.16.154.82:6789 + - 10.16.154.83:6789 + user: admin + secretFile: "/etc/ceph/admin.secret" + readOnly: true