From 53e52018018caffadbc76fae4f12786025bf56f7 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Tue, 8 Aug 2017 14:03:04 -0700 Subject: [PATCH] docs: remove references to yaml files --- Documentation/advanced-configuration.md | 4 +- .../{cluster-tpr.md => cluster-crd.md} | 129 +++++++++++++++++- Documentation/k8s-block.md | 24 +++- Documentation/k8s-filesystem.md | 64 ++++++++- Documentation/k8s-object.md | 30 +++- Documentation/kubernetes.md | 34 ++++- Documentation/{pool-tpr.md => pool-crd.md} | 4 +- Documentation/toolbox.md | 60 ++++++-- 8 files changed, 314 insertions(+), 35 deletions(-) rename Documentation/{cluster-tpr.md => cluster-crd.md} (67%) rename Documentation/{pool-tpr.md => pool-crd.md} (91%) diff --git a/Documentation/advanced-configuration.md b/Documentation/advanced-configuration.md index ef4e72751..ecf8c0d6e 100644 --- a/Documentation/advanced-configuration.md +++ b/Documentation/advanced-configuration.md @@ -226,7 +226,7 @@ ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY Now we have a separate storage group for our SSDs, but we can't use that storage until we associate a pool with it. The default group already has a pool called -`rbd` in many cases. If you [created a pool via ThirdPartyResource](pool-tpr.md), +`rbd` in many cases. If you [created a pool via ThirdPartyResource](pool-crd.md), it will use the default storage group as well. Here's how to create new pools: @@ -293,7 +293,7 @@ and OSDs in the `default` root hierarchy. The `size` setting of a pool tells the cluster how many copies of the data should be kept for redundancy. By default the cluster will distribute these copies between `host` buckets in the CRUSH Map This can be set when [creating a -pool via ThirdPartyResource](pool-tpr.md) or after creation with `ceph`. +pool via ThirdPartyResource](pool-crd.md) or after creation with `ceph`. So for example let's change the `size` of the `rbd` pool to three: diff --git a/Documentation/cluster-tpr.md b/Documentation/cluster-crd.md similarity index 67% rename from Documentation/cluster-tpr.md rename to Documentation/cluster-crd.md index a030898ed..7d7f56de4 100644 --- a/Documentation/cluster-tpr.md +++ b/Documentation/cluster-crd.md @@ -1,12 +1,12 @@ --- -title: Cluster TPR +title: Cluster CRD weight: 17 indent: true --- # Creating Rook Clusters -Rook allows creation and customization of storage clusters through the third party resources (TPRs). The following settings are +Rook allows creation and customization of storage clusters through the custom resource definitions (CRDs). The following settings are available for a cluster. ## Settings @@ -73,6 +73,127 @@ A Placement configuration is specified (according to the kubernetes [PodSpec](ht - `nodeAffinity`: kubernetes [NodeAffinity](https://kubernetes.io/docs/api-reference/v1.6/#nodeaffinity-v1-core) - `tolerations`: list of kubernetes [Toleration](https://kubernetes.io/docs/api-reference/v1.6/#toleration-v1-core) -## Sample +## Samples -A sample cluster TPR can be found and used in the [rook-cluster.yaml](https://github.com/rook/rook/blob/master/demo/kubernetes/rook-cluster.yaml) file in the Kubernetes demo directory. +### Storage configuration: All devices + +``` +apiVersion: v1 +kind: Namespace +metadata: + name: rook +--- +apiVersion: rook.io/v1alpha1 +kind: Cluster +metadata: + name: rook + namespace: rook +spec: + versionTag: master + dataDirHostPath: + # cluster level storage configuration and selection + storage: + useAllNodes: true + useAllDevices: true + deviceFilter: + metadataDevice: + location: + storeConfig: + storeType: bluestore + databaseSizeMB: 1024 # this value can be removed for environments with normal sized disks (100 GB or larger) + journalSizeMB: 1024 # this value can be removed for environments with normal sized disks (20 GB or larger) +``` + +### Storage Configuration: Specific devices + +Individual nodes and their config can be specified so that only the named nodes below will be used as storage resources. +Each node's 'name' field should match their 'kubernetes.io/hostname' label. + +``` +apiVersion: v1 +kind: Namespace +metadata: + name: rook +--- +apiVersion: rook.io/v1alpha1 +kind: Cluster +metadata: + name: rook + namespace: rook +spec: + versionTag: master + dataDirHostPath: + # cluster level storage configuration and selection + storage: + useAllNodes: false + useAllDevices: false + deviceFilter: + metadataDevice: + location: + storeConfig: + storeType: filestore + databaseSizeMB: 1024 # this value can be removed for environments with normal sized disks (100 GB or larger) + journalSizeMB: 1024 # this value can be removed for environments with normal sized disks (20 GB or larger) + nodes: + - name: "172.17.4.101" + directories: # specific directores to use for storage can be specified for each node + - path: "/rook/storage-dir" + - name: "172.17.4.201" + devices: # specific devices to use for storage can be specified for each node + - name: "sdb" + - name: "sdc" + storeConfig: # configuration can be specified at the node level which overrides the cluster level config + storeType: bluestore + - name: "172.17.4.301" + deviceFilter: "^sd." +``` + +### Node Affinity + +To control where various services will be scheduled by kubernetes, use the placement configuration sections below. +The example under 'all' would have all services scheduled on kubernetes nodes labeled with 'role=storage' and +tolerate taints with a key of 'storage-node'. + +``` +apiVersion: v1 +kind: Namespace +metadata: + name: rook +--- +apiVersion: rook.io/v1alpha1 +kind: Cluster +metadata: + name: rook + namespace: rook +spec: + versionTag: master + dataDirHostPath: + placement: + all: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: role + operator: In + values: + - storage-node + tolerations: + - key: storage-node + operator: Exists + api: + nodeAffinity: + tolerations: + mds: + nodeAffinity: + tolerations: + mon: + nodeAffinity: + tolerations: + osd: + nodeAffinity: + tolerations: + rgw: + nodeAffinity: + tolerations: +``` diff --git a/Documentation/k8s-block.md b/Documentation/k8s-block.md index 3a3367dee..2f052f798 100644 --- a/Documentation/k8s-block.md +++ b/Documentation/k8s-block.md @@ -14,8 +14,30 @@ This guide assumes you have created a Rook cluster as explained in the main [Kub ## Provision Storage -Before Rook can start provisioning storage, a StorageClass and its storage pool need to be created. This is needed for Kubernetes to interoperate with Rook for provisioning persistent volumes. The [rook-storageclass.yaml](https://github.com/rook/rook/blob/master/demo/kubernetes/rook-storageclass.yaml) sample will create the storage pool automatically. For more options on pools, see the documentation on [creating storage pools](pool-tpr.md). +Before Rook can start provisioning storage, a StorageClass and its storage pool need to be created. This is needed for Kubernetes to interoperate with Rook for provisioning persistent volumes. For more options on pools, see the documentation on [creating storage pools](pool-crd.md). +Save this storage class definition as `rook-storageclass.yaml`: + +```yaml +apiVersion: rook.io/v1alpha1 +kind: Pool +metadata: + name: replicapool + namespace: rook +spec: + replication: + size: 1 +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: rook-block +provisioner: rook.io/block +parameters: + pool: replicapool +``` + +Create the storage class. ```bash kubectl create -f rook-storageclass.yaml ``` diff --git a/Documentation/k8s-filesystem.md b/Documentation/k8s-filesystem.md index 83dff218b..c095a0835 100644 --- a/Documentation/k8s-filesystem.md +++ b/Documentation/k8s-filesystem.md @@ -16,7 +16,7 @@ This guide assumes you have created a Rook cluster and pool as explained in the ## Rook Client -Setting up the Rook file system requires running `rookctl` commands with the [Rook toolbox](kubernetes.md#tools). This will be simplified in the future with a TPR for the file system. +Setting up the Rook file system requires running `rookctl` commands with the [Rook toolbox](kubernetes.md#tools). This will be simplified in the future with a CRD for the file system. ## Create the File System @@ -48,9 +48,61 @@ ceph osd pool set registryFS-metadata size 2 ## Deploy the Application -The kube-registry yaml is defined [here](/demo/kubernetes/kube-registry.yaml). We will need to update the yaml with the monitor IP addresses with the following commands. -In the future this step will be improved with a Rook volume plugin. +Save the following spec as `kube-registry.yaml`: +```yaml +apiVersion: v1 +kind: ReplicationController +metadata: + name: kube-registry-v0 + namespace: kube-system + labels: + k8s-app: kube-registry + version: v0 + kubernetes.io/cluster-service: "true" +spec: + replicas: 3 + selector: + k8s-app: kube-registry + version: v0 + template: + metadata: + labels: + k8s-app: kube-registry + version: v0 + kubernetes.io/cluster-service: "true" + spec: + containers: + - name: registry + image: registry:2 + resources: + limits: + cpu: 100m + memory: 100Mi + env: + - name: REGISTRY_HTTP_ADDR + value: :5000 + - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY + value: /var/lib/registry + volumeMounts: + - name: image-store + mountPath: /var/lib/registry + ports: + - containerPort: 5000 + name: registry + protocol: TCP + volumes: + - name: image-store + cephfs: + monitors: + - INSERT_MONS_HERE + user: admin + secretRef: + name: rook-admin +``` + +We will need to update the yaml with the monitor IP addresses with the following commands. +In the future this step will be improved with a Rook volume plugin. ```bash cd demo/kubernetes export MONS=$(kubectl -n rook get pod -l app=rook-ceph-mon -o json|jq ".items[].status.podIP"|tr -d "\""|sed -e 's/$/:6790/'|paste -s -d, -) @@ -63,11 +115,9 @@ You now have a docker registry which is HA with persistent storage. Once you have pushed an image to the registry (see the [instructions](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/registry) to expose and use the kube-registry), verify that kube-registry is using the filesystem that was configured above by mounting the shared file system in the toolbox pod. -```bash -# Start and connect to the toolbox pod -kubectl create -f rook-tools.yaml -kubectl -n rook exec rook-tools -it sh +Start and connect to the [Rook toolbox](toolbox.md). +```bash # Mount the same filesystem that the kube-registry is using mkdir /tmp/registry rookctl filesystem mount --name registryFS --path /tmp/registry diff --git a/Documentation/k8s-object.md b/Documentation/k8s-object.md index aaed3b621..ee981a360 100644 --- a/Documentation/k8s-object.md +++ b/Documentation/k8s-object.md @@ -14,7 +14,7 @@ This guide assumes you have created a Rook cluster as explained in the main [Kub ## Rook Client -Setting up the object storage requires running `rookctl` commands with the [Rook toolbox](kubernetes.md#tools) pod. This will be simplified in the future with a TPR for the object stores. +Setting up the object storage requires running `rookctl` commands with the [Rook toolbox](kubernetes.md#tools) pod. This will be simplified in the future with a CRD for the object stores. ## Create the Object Store and User @@ -53,9 +53,33 @@ NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE rook-ceph-rgw 10.3.0.177 53390/TCP 2m ``` -Now create the external service: +Save the external service as `rgw-external.yaml`: + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: rook-ceph-rgw-external + namespace: rook + labels: + app: rook-ceph-rgw + rook_cluster: rook +spec: + ports: + - name: rgw + port: 53390 + protocol: TCP + targetPort: 53390 + selector: + app: rook-ceph-rgw + rook_cluster: rook + sessionAffinity: None + type: NodePort +``` + +Now create the external service. + ```bash -cd demo/kubernetes kubectl create -f rgw-external.yaml ``` diff --git a/Documentation/kubernetes.md b/Documentation/kubernetes.md index 10d7abe69..cab554f30 100644 --- a/Documentation/kubernetes.md +++ b/Documentation/kubernetes.md @@ -30,7 +30,7 @@ If you are using `dataDirHostPath` to persist rook data on kubernetes hosts, mak ### Deploy Rook -With your Kubernetes cluster running, Rook can be setup and deployed by simply creating the [rook-operator](/demo/kubernetes/rook-operator.yaml) deployment and creating a [rook cluster](/demo/kubernetes/rook-cluster.yaml). +With your Kubernetes cluster running, Rook can be setup and deployed by simply creating the rook-operator deployment and creating a rook cluster. ```bash cd demo/kubernetes @@ -41,7 +41,35 @@ kubectl get pod ``` Now that the rook-operator pod is running, we can create the Rook cluster. For the cluster to survive reboots, -make sure you set the `dataDirHostPath` property. See the documentation on [configuring the cluster](cluster-tpr.md). +make sure you set the `dataDirHostPath` property. For more settings, see the documentation on [configuring the cluster](cluster-crd.md). + +Save the cluster spec as `rook-cluster.yaml`: + +```yaml +apiVersion: v1 +kind: Namespace +metadata: + name: rook +--- +apiVersion: rook.io/v1alpha1 +kind: Cluster +metadata: + name: rook + namespace: rook +spec: + versionTag: master + dataDirHostPath: + storage: + useAllNodes: true + useAllDevices: false + storeConfig: + storeType: filestore + databaseSizeMB: 1024 + journalSizeMB: 1024 +``` + +Create the cluster: + ```bash kubectl create -f rook-cluster.yaml ``` @@ -68,7 +96,7 @@ For a walkthrough of the three types of storage exposed by Rook, see the guides ## Tools -We have created a [toolbox](/demo/kubernetes/rook-tools.yaml) container that contains the full suite of Ceph clients for debugging and troubleshooting your Rook cluster. Please see the [toolbox readme](toolbox.md) for setup and usage information. Also see our [advanced configuration](advanced-configuration.md) document for helpful maintenance and tuning examples. +We have created a toolbox container that contains the full suite of Ceph clients for debugging and troubleshooting your Rook cluster. Please see the [toolbox readme](toolbox.md) for setup and usage information. Also see our [advanced configuration](advanced-configuration.md) document for helpful maintenance and tuning examples. The toolbox also contains the `rookctl` tool as required in the [File System](k8s-filesystem.md) and [Object](k8s-object.md) walkthroughs, or a [simplified walkthrough of block, file and object storage](client.md). In the near future, `rookctl` will not be required for kubernetes scenarios. diff --git a/Documentation/pool-tpr.md b/Documentation/pool-crd.md similarity index 91% rename from Documentation/pool-tpr.md rename to Documentation/pool-crd.md index 82ac01d4b..d1462444b 100644 --- a/Documentation/pool-tpr.md +++ b/Documentation/pool-crd.md @@ -1,12 +1,12 @@ --- -title: Pool TPR +title: Pool CRD weight: 16 indent: true --- # Creating Rook Storage Pools -Rook allows creation and customization of storage pools through the third party resources (TPRs). The following settings are available +Rook allows creation and customization of storage pools through the custom resource definitions (CRDs). The following settings are available for pools. ## Sample diff --git a/Documentation/toolbox.md b/Documentation/toolbox.md index a4a43eb1e..87cdd4b5a 100644 --- a/Documentation/toolbox.md +++ b/Documentation/toolbox.md @@ -4,23 +4,57 @@ weight: 40 --- # Rook Toolbox -The rook toolbox is a container with common tools used for rook debugging and testing. All packages in the toolbox can be seen in the [Dockerfile](/toolbox/Dockerfile) - -## Installing more tools - -The rook toolbox is based on Ubuntu, so more tools of your choosing can be easily installed with `apt-get`. For example, to install `telnet`: -```bash -apt-get update -apt-get install telnet -``` +The Rook toolbox is a container with common tools used for rook debugging and testing. +The toolbox is based on Ubuntu, so more tools of your choosing can be easily installed with `apt-get`. ## Running the Toolbox in Kubernetes -The rook toolbox can run as a pod in a Kubernetes cluster. First, ensure you have a running Kubernetes cluster with rook deployed (see the [Kubernetes](kubernetes.md) instructions). +The rook toolbox can run as a pod in a Kubernetes cluster. After you ensure you have a running Kubernetes cluster with rook deployed (see the [Kubernetes](kubernetes.md) instructions), +launch the rook-tools pod. + +Save the tools spec as `rook-tools.yaml`: + +```yaml +apiVersion: v1 +kind: Pod +metadata: + name: rook-tools + namespace: rook +spec: + containers: + - name: rook-tools + image: rook/toolbox:master + imagePullPolicy: IfNotPresent + args: ["sleep", "36500d"] + env: + - name: ROOK_ADMIN_SECRET + valueFrom: + secretKeyRef: + name: rook-ceph-mon + key: admin-secret + securityContext: + privileged: true + volumeMounts: + - mountPath: /dev + name: dev + - mountPath: /sys/bus + name: sysbus + - mountPath: /lib/modules + name: libmodules + volumes: + - name: dev + hostPath: + path: /dev + - name: sysbus + hostPath: + path: /sys/bus + - name: libmodules + hostPath: + path: /lib/modules +``` Launch the rook-tools pod: ```bash -cd demo/kubernetes kubectl create -f rook-tools.yaml ``` @@ -41,9 +75,9 @@ ceph df rados df ``` -When you are done with the toolbox, you can clean it up by running: +When you are done with the toolbox, remove the pod: ```bash -kubectl delete -f rook-tools.yaml +kubectl -n rook delete pod rook-tools ``` ## Running the Toolbox for Standalone