|
1 |
| -## Step 1. Setting up Fibre Channel Target |
| 1 | +# Consuming Fibre Channel Storage on Kubernetes |
2 | 2 |
|
3 |
| -On your FC SAN Zone manager, allocate and mask LUNs so Kubernetes hosts can access them. |
| 3 | +## Table of Contents |
4 | 4 |
|
5 |
| -## Step 2. Creating the Pod with Fibre Channel persistent storage |
| 5 | +- [Example Parameters](#example-parameters) |
| 6 | +- [Step-by-Step](#step-by-step) |
| 7 | +- [Multipath Considerations](#multipath-considerations) |
6 | 8 |
|
7 |
| -Once you have installed Fibre Channel initiator and new Kubernetes, you can create a pod based on my example [fc.yaml](fc.yaml). In the pod JSON, you need to provide *targetWWNs* (array of Fibre Channel target's World Wide Names), *lun*, and the type of the filesystem that has been created on the lun, and *readOnly* boolean. |
| 9 | +## Example Parameters |
8 | 10 |
|
9 |
| -Once your pod is created, run it on the Kubernetes master: |
10 |
| - |
11 |
| -```console |
12 |
| -kubectl create -f ./your_new_pod.json |
| 11 | +```yaml |
| 12 | + fc: |
| 13 | + targetWWNs: |
| 14 | + - '500a0982991b8dc5' |
| 15 | + - '500a0982891b8dc5' |
| 16 | + lun: 2 |
| 17 | + fsType: ext4 |
| 18 | + readOnly: true |
13 | 19 | ```
|
14 | 20 |
|
15 |
| -Here is my command and output: |
| 21 | +[API Reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#fcvolumesource-v1-core) |
| 22 | +
|
| 23 | +## Step-by-Step |
| 24 | +
|
| 25 | +### Set up a Fibre Channel Target |
| 26 | +
|
| 27 | +Using your Fibre Channel SAN Zone manager you must allocate and mask LUNs so that all hosts in the Kubernetes cluster can access them |
| 28 | +
|
| 29 | +### Prepare nodes in your Kubernetes cluster |
| 30 | +
|
| 31 | +You will need to install and configured a Fibre Channel initiator on the hosts within your Kubernetes cluster. |
| 32 | +
|
| 33 | +### Create a Pod using Fibre Channel persistent storage |
| 34 | +
|
| 35 | +Create a pod manifest based on [fc.yaml](fc.yaml). You will need to provide *targetWWNs* (array of Fibre Channel target's World Wide Names), *lun*, and the type of the filesystem that has been created on the LUN if it is not _ext4_ |
| 36 | +
|
| 37 | +Once you have created a pod manifest you can deploy it by running: |
16 | 38 |
|
17 | 39 | ```console
|
18 |
| -# kubectl create -f examples/volumes/fibre_channel/fc.yaml |
19 |
| -# kubectl get pods |
20 |
| -NAME READY STATUS RESTARTS AGE |
21 |
| -fcpd 2/2 Running 0 10m |
| 40 | +kubectl apply -f ./your_new_pod.yaml |
22 | 41 | ```
|
23 | 42 |
|
24 |
| -On the Kubernetes host, I got these in mount output |
| 43 | +You can then confirm that the pod hase been sucessfully deployed by running `kubectl get pod fibre-channel-example-pod -o wide` |
25 | 44 |
|
26 | 45 | ```console
|
27 |
| -#mount |grep /var/lib/kubelet/plugins/kubernetes.io |
28 |
| -/dev/mapper/360a98000324669436c2b45666c567946 on /var/lib/kubelet/plugins/kubernetes.io/fc/500a0982991b8dc5-lun-2 type ext4 (ro,relatime,seclabel,stripe=16,data=ordered) |
29 |
| -/dev/mapper/360a98000324669436c2b45666c567944 on /var/lib/kubelet/plugins/kubernetes.io/fc/500a0982991b8dc5-lun-1 type ext4 (rw,relatime,seclabel,stripe=16,data=ordered) |
| 46 | +# kubectl get pod fibre-channel-example-pod -o wide |
| 47 | +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES |
| 48 | +fibre-channel-example-pod 1/1 READY 0 1m8s 192.168.172.11 node0 <none> <none> |
| 49 | + |
30 | 50 | ```
|
31 | 51 |
|
32 |
| -If you ssh to that machine, you can run `docker ps` to see the actual pod. |
| 52 | +If you connect to the console on the Kubernetes node that the pod has been assigned to you can see that the volume is mounted to the pod by running `mount | grep /var/lib/kubelet/plugins/kubernetes.io/fc/` |
33 | 53 |
|
34 | 54 | ```console
|
35 |
| -# docker ps |
36 |
| -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
37 |
| -090ac457ddc2 kubernetes/pause "/pause" 12 minutes ago Up 12 minutes k8s_fcpd-rw.aae720ec_fcpd_default_4024318f-4121-11e5-a294-e839352ddd54_99eb5415 |
38 |
| -5e2629cf3e7b kubernetes/pause "/pause" 12 minutes ago Up 12 minutes k8s_fcpd-ro.857720dc_fcpd_default_4024318f-4121-11e5-a294-e839352ddd54_c0175742 |
39 |
| -2948683253f7 k8s.gcr.io/pause:0.8.0 "/pause" 12 minutes ago Up 12 minutes k8s_POD.7be6d81d_fcpd_default_4024318f-4121-11e5-a294-e839352ddd54_8d9dd7bf |
40 |
| -``` |
| 55 | +# mount | grep /var/lib/kubelet/plugins/kubernetes.io/fc/ |
| 56 | +/dev/mapper/360a98000324669436c2b45666c567946 on /var/lib/kubelet/plugins/kubernetes.io/fc/500a0982991b8dc5-lun-2 type ext4 (relatime,seclabel,stripe=16,data=ordered) |
| 57 | + ``` |
41 | 58 |
|
42 |
| -## Multipath |
| 59 | +## Multipath Considerations |
43 | 60 |
|
44 |
| -To leverage multiple paths for block storage, it is important to perform the |
| 61 | +To leverage multiple paths for block storage, it is important to perform |
45 | 62 | multipath configuration on the host.
|
46 | 63 | If your distribution does not provide `/etc/multipath.conf`, then you can
|
47 | 64 | either use the following minimalistic one:
|
48 | 65 |
|
49 |
| - defaults { |
50 |
| - find_multipaths yes |
51 |
| - user_friendly_names yes |
52 |
| - } |
| 66 | +``` |
| 67 | +defaults { |
| 68 | + find_multipaths yes |
| 69 | + user_friendly_names yes |
| 70 | +} |
| 71 | +``` |
53 | 72 |
|
54 | 73 | or create a new one by running:
|
55 | 74 |
|
56 |
| - $ mpathconf --enable |
| 75 | +```console |
| 76 | +$ mpathconf --enable |
| 77 | +``` |
57 | 78 |
|
58 | 79 | Finally you'll need to ensure to start or reload and enable multipath:
|
59 | 80 |
|
60 |
| - $ systemctl enable multipathd.service |
61 |
| - $ systemctl restart multipathd.service |
| 81 | +```console |
| 82 | +$ systemctl enable --now multipathd.service |
| 83 | +``` |
62 | 84 |
|
63 | 85 | **Note:** Any change to `multipath.conf` or enabling multipath can lead to
|
64 |
| -inaccessible block devices, because they'll be claimed by multipath and |
| 86 | +inaccessible block devices as they will be claimed by multipath and |
65 | 87 | exposed as a device in /dev/mapper/*.
|
66 | 88 |
|
67 |
| -Some additional informations about multipath can be found in the |
68 |
| -[iSCSI documentation](../iscsi/README.md) |
69 |
| - |
70 | 89 |
|
71 | 90 | <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
72 | 91 | []()
|
|
0 commit comments