Skip to content

Commit cc3e765

Browse files
enhance fibre channel example
1 parent 77d37b4 commit cc3e765

File tree

2 files changed

+67
-45
lines changed

2 files changed

+67
-45
lines changed

staging/volumes/fibre_channel/README.md

Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,93 @@
1-
## Step 1. Setting up Fibre Channel Target
1+
# Consuming Fibre Channel Storage on Kubernetes
22

3-
On your FC SAN Zone manager, allocate and mask LUNs so Kubernetes hosts can access them.
3+
## Table of Contents
44

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)
68

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
810

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
1319
```
1420
15-
Here is my command and output:
21+
[API Reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#fcvolumesource-v1-core)
1622
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
2324
24-
On the Kubernetes host, I got these in mount output
25+
1. Set up a Fibre Channel Target
2526
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
3128
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
3330
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+
```
4142

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`
4344

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
4564
multipath configuration on the host.
4665
If your distribution does not provide `/etc/multipath.conf`, then you can
4766
either use the following minimalistic one:
4867

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+
```
5374

5475
or create a new one by running:
5576

56-
$ mpathconf --enable
77+
```console
78+
$ mpathconf --enable
79+
```
5780

5881
Finally you'll need to ensure to start or reload and enable multipath:
5982

60-
$ systemctl enable multipathd.service
61-
$ systemctl restart multipathd.service
83+
```console
84+
$ systemctl enable --now multipathd.service
85+
```
6286

6387
**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
6589
exposed as a device in /dev/mapper/*.
6690

67-
Some additional informations about multipath can be found in the
68-
[iSCSI documentation](../iscsi/README.md)
69-
7091

7192
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
7293
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/volumes/fibre_channel/README.md?pixel)]()

staging/volumes/fibre_channel/fc.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: Pod
33
metadata:
4-
name: fc
4+
name: fibre-channel-example-pod
55
spec:
66
containers:
77
- image: kubernetes/pause
@@ -12,7 +12,8 @@ spec:
1212
volumes:
1313
- name: fc-vol
1414
fc:
15-
targetWWNs: ['500a0982991b8dc5', '500a0982891b8dc5']
16-
lun: 2
15+
targetWWNs:
16+
- <ADD Target WWN Here>
17+
lun: <ADD LUN ID Here>
1718
fsType: ext4
1819
readOnly: true

0 commit comments

Comments
 (0)