k3s/examples/iscsi/README.md

115 lines
5.8 KiB
Markdown
Raw Normal View History

2015-07-14 00:13:09 +00:00
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
2015-07-16 17:02:26 +00:00
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
2015-07-13 22:15:35 +00:00
2015-07-16 17:02:26 +00:00
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
2015-07-14 00:13:09 +00:00
2015-07-16 17:02:26 +00:00
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
2015-07-14 00:13:09 +00:00
2015-12-14 18:37:38 +00:00
<!-- TAG RELEASE_LINK, added by the munger automatically -->
2015-07-16 17:02:26 +00:00
<strong>
2015-11-03 18:17:57 +00:00
The latest release of this document can be found
[here](http://releases.k8s.io/release-1.2/examples/iscsi/README.md).
2015-07-16 17:02:26 +00:00
Documentation for other releases can be found at
[releases.k8s.io](http://releases.k8s.io).
</strong>
--
2015-07-13 22:15:35 +00:00
2015-07-14 00:13:09 +00:00
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
2015-07-17 22:35:41 +00:00
## Step 1. Setting up iSCSI target and iSCSI initiator
2015-07-17 22:35:41 +00:00
2015-05-13 17:36:06 +00:00
**Setup A.** On Fedora 21 nodes
If you use Fedora 21 on Kubernetes node, then first install iSCSI initiator on the node:
# yum -y install iscsi-initiator-utils
2015-07-24 21:52:18 +00:00
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
then edit */etc/iscsi/iscsid.conf* to match your iSCSI target configuration.
I mostly followed these [instructions](http://www.server-world.info/en/note?os=Fedora_21&p=iscsi) to setup iSCSI target. and these [instructions](http://www.server-world.info/en/note?os=Fedora_21&p=iscsi&f=2) to setup iSCSI initiator.
**Setup B.** On Unbuntu 12.04 and Debian 7 nodes on Google Compute Engine (GCE)
2015-05-13 17:36:06 +00:00
GCE does not provide preconfigured Fedora 21 image, so I set up the iSCSI target on a preconfigured Ubuntu 12.04 image, mostly following these [instructions](http://www.server-world.info/en/note?os=Ubuntu_12.04&p=iscsi). My Kubernetes cluster on GCE was running Debian 7 images, so I followed these [instructions](http://www.server-world.info/en/note?os=Debian_7.0&p=iscsi&f=2) to set up the iSCSI initiator.
2015-07-17 22:35:41 +00:00
## Step 2. Creating the pod with iSCSI persistent storage
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
Once you have installed iSCSI initiator and new Kubernetes, you can create a pod based on the example *iscsi.json*. In the pod JSON, you need to provide *targetPortal* (the iSCSI target's **IP** address and *port* if not the default port 3260), target's *iqn*, *lun*, and the type of the filesystem that has been created on the lun, and *readOnly* boolean. No initiator information is required.
If you want to use an iSCSI offload card or other open-iscsi transports besides tcp, setup an iSCSI interface and provide *iscsiInterface* in the pod JSON. The default name for an iscsi iface (open-iscsi parameter iface.iscsi\_ifacename) is in the format transport\_name.hwaddress when generated by iscsiadm. See [open-iscsi](http://www.open-iscsi.org/docs/README) or [openstack](http://docs.openstack.org/kilo/config-reference/content/iscsi-iface-config.html) for detailed configuration information.
**Note:** If you have followed the instructions in the links above you
may have partitioned the device, the iSCSI volume plugin does not
currently support partitions so format the device as one partition.
Make sure you have the correct device name then run the following as
root to format it:
```console
mkfs.ext4 /dev/<name of device>
```
Once your pod is created, run it on the Kubernetes master:
```console
kubectl create -f ./your_new_pod.json
```
Here is my command and output:
```console
# kubectl create -f examples/iscsi/iscsi.json
# kubectl get pods
NAME READY STATUS RESTARTS AGE
iscsipd 2/2 RUNNING 0 2m
```
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
On the Kubernetes node, verify the mount output
```console
# mount |grep kub
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
/dev/sdb on /var/lib/kubelet/plugins/kubernetes.io/iscsi/10.0.2.15:3260-iqn.2001-04.com.example:storage.kube.sys1.xyz-lun-0 type ext4 (ro,relatime,data=ordered)
/dev/sdb on /var/lib/kubelet/pods/f527ca5b-6d87-11e5-aa7e-080027ff6387/volumes/kubernetes.io~iscsi/iscsipd-ro type ext4 (ro,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/plugins/kubernetes.io/iscsi/10.0.2.15:3260-iqn.2001-04.com.example:storage.kube.sys1.xyz-lun-1 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/pods/f527ca5b-6d87-11e5-aa7e-080027ff6387/volumes/kubernetes.io~iscsi/iscsipd-rw type ext4 (rw,relatime,data=ordered)
```
If you ssh to that machine, you can run `docker ps` to see the actual pod.
2015-07-17 02:01:02 +00:00
```console
# docker ps
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f855336407f4 kubernetes/pause "/pause" 6 minutes ago Up 6 minutes k8s_iscsipd-ro.d130ec3e_iscsipd_default_f527ca5b-6d87-11e5-aa7e-080027ff6387_5409a4cb
3b8a772515d2 kubernetes/pause "/pause" 6 minutes ago Up 6 minutes k8s_iscsipd-rw.ed58ec4e_iscsipd_default_f527ca5b-6d87-11e5-aa7e-080027ff6387_d25592c5
```
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
Run *docker inspect* and verify the container mounted the host directory into the their */mnt/iscsipd* directory.
2015-07-17 02:01:02 +00:00
```console
Fix extraneous entries in iscsi path format Code comments currently claim the default iscsi mount path as kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual path being used is kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id> This leads to ultimate path being similar to this : kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N Both iscsi and iqn are repated twice for no reason, since "iqn" is required by spec to be part of an iqn. This is also wrong on multiple leves as actual allowed naming formats are : iqn.2001-04.com.example:storage:diskarrays-sn-a8675309 eui.02004567A425678D (RFC 3720 3.2.6.3) and in the second case "iqn-eui" in the path would be misleading. Change this to a more reasonable path of kubernetes.io/iscsi/<portal>-<iqn>-lun-<id> which also aligns up with how the /dev/by-path and sysfs entries are created for iscsi devices on linux * -- * Update iSCSI README and sample json file There seems to have been quite a skew in recent updates to these files adding in wrong info or info that no longer lines up the sample config with the README. Fixed the following issues : * Fix discrepancy in samples json using initiator iqn from previous linked example as target iqn (which was just wrong) * Generate sample output and README from the same json config provided. * Remove recommendation to edit initiator name, this is not required (open-iscsi warns against editing this manually and provides a utility for the same) * Update docker inspect command to one that works. * Use separate LUNs for separate mount points instead of re-using.
2015-10-08 08:21:17 +00:00
# docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/mnt/iscsipd" }}{{ .Source }}{{ end }}{{ end }}' f855336407f4
/var/lib/kubelet/pods/f527ca5b-6d87-11e5-aa7e-080027ff6387/volumes/kubernetes.io~iscsi/iscsipd-ro
# docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/mnt/iscsipd" }}{{ .Source }}{{ end }}{{ end }}' 3b8a772515d2
/var/lib/kubelet/pods/f527ca5b-6d87-11e5-aa7e-080027ff6387/volumes/kubernetes.io~iscsi/iscsipd-rw
```
2015-07-14 00:13:09 +00:00
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/iscsi/README.md?pixel)]()
2015-07-14 00:13:09 +00:00
<!-- END MUNGE: GENERATED_ANALYTICS -->