|
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) |
16 | 22 |
|
17 |
| -```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 |
22 |
| -``` |
| 23 | +## Step-by-Step |
23 | 24 |
|
24 |
| -On the Kubernetes host, I got these in mount output |
| 25 | +1. Set up a Fibre Channel Target |
25 | 26 |
|
26 |
| -```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) |
30 |
| -``` |
| 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 |
31 | 28 |
|
32 |
| -If you ssh to that machine, you can run `docker ps` to see the actual pod. |
| 29 | +2. Prepare nodes in your Kubernetes cluster |
33 | 30 |
|
34 |
| -```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 |
| -``` |
| 31 | + You will need to install and configured a Fibre Channel initiator on the hosts within your Kubernetes cluster. |
| 32 | +
|
| 33 | +3. 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: |
| 38 | +
|
| 39 | + ```console |
| 40 | + kubectl apply -f ./your_new_pod.yaml |
| 41 | + ``` |
41 | 42 |
|
42 |
| -## Multipath |
| 43 | + You can then confirm that the pod hase been sucessfully deployed by running `kubectl get pod fibre-channel-example-pod -o wide` |
43 | 44 |
|
44 |
| -To leverage multiple paths for block storage, it is important to perform the |
| 45 | + ```console |
| 46 | + # kubectl get pod fibre-channel-example-pod -o wide |
| 47 | + NAME READY STATUS RESTARTS AGE |
| 48 | + 1/1 Running 0 1m |
| 49 | + NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES |
| 50 | + fibre-channel-example-pod 1/1 READY 0 1m8s 192.168.172.11 node0 <none> <none> |
| 51 | + |
| 52 | + ``` |
| 53 | + |
| 54 | + 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/` |
| 55 | + |
| 56 | + ```console |
| 57 | + # mount | grep /var/lib/kubelet/plugins/kubernetes.io/fc/ |
| 58 | + /dev/mapper/360a98000324669436c2b45666c567946 on /var/lib/kubelet/plugins/kubernetes.io/fc/500a0982991b8dc5-lun-2 type ext4 (relatime,seclabel,stripe=16,data=ordered) |
| 59 | + ``` |
| 60 | + |
| 61 | +## Multipath Considerations |
| 62 | + |
| 63 | +To leverage multiple paths for block storage, it is important to perform |
45 | 64 | multipath configuration on the host.
|
46 | 65 | If your distribution does not provide `/etc/multipath.conf`, then you can
|
47 | 66 | either use the following minimalistic one:
|
48 | 67 |
|
49 |
| - defaults { |
50 |
| - find_multipaths yes |
51 |
| - user_friendly_names yes |
52 |
| - } |
| 68 | +``` |
| 69 | +defaults { |
| 70 | + find_multipaths yes |
| 71 | + user_friendly_names yes |
| 72 | +} |
| 73 | +``` |
53 | 74 |
|
54 | 75 | or create a new one by running:
|
55 | 76 |
|
56 |
| - $ mpathconf --enable |
| 77 | +```console |
| 78 | +$ mpathconf --enable |
| 79 | +``` |
57 | 80 |
|
58 | 81 | Finally you'll need to ensure to start or reload and enable multipath:
|
59 | 82 |
|
60 |
| - $ systemctl enable multipathd.service |
61 |
| - $ systemctl restart multipathd.service |
| 83 | +```console |
| 84 | +$ systemctl enable --now multipathd.service |
| 85 | +``` |
62 | 86 |
|
63 | 87 | **Note:** Any change to `multipath.conf` or enabling multipath can lead to
|
64 |
| -inaccessible block devices, because they'll be claimed by multipath and |
| 88 | +inaccessible block devices as they will be claimed by multipath and |
65 | 89 | exposed as a device in /dev/mapper/*.
|
66 | 90 |
|
67 |
| -Some additional informations about multipath can be found in the |
68 |
| -[iSCSI documentation](../iscsi/README.md) |
69 |
| - |
70 | 91 |
|
71 | 92 | <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
72 | 93 | []()
|
|
0 commit comments