Currently using the loopback mode driver, which isn't recommended for production systems https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
k8s: Use direct-lvm for docker storage backend | operations/puppet | production | +51 -14 |
Related Objects
- Mentioned In
- rOPUPd69cf9fa230d: k8s: Use direct-lvm for docker storage backend
rOPUPfad6433743a2: k8s: Use direct-lvm for docker storage backend
rOPUPf8b3d4cc90e4: k8s: Use direct-lvm for docker storage backend
rOPUP628614d2966d: k8s: Use direct-lvm for docker storage backend
rOPUP5eb129a21e0e: k8s: Use direct-lvm for docker storage backend
rOPUP9fb702f2155c: k8s: Use direct-lvm for docker storage backend
rOPUP3ac96886421e: k8s: Use direct-lvm for docker storage backend
rOPUPe4cd5ddec6b0: k8s: Use direct-lvm for docker storage backend
rOPUP306a849aae23: k8s: Use direct-lvm for docker storage backend
rOPUP2f6aee619061: k8s: Use direct-lvm for docker storage backend
rOPUP3744d6bca5c1: k8s: Use direct-lvm for docker storage backend
rOPUP3f9bf3853ab4: k8s: Use direct-lvm for docker storage backend
rOPUP945951b967ae: k8s: Use direct-lvm for docker storage backend
T141017: Kubernetes worker nodes hanging
Event Timeline
I tried this and am at:
daemon: error initializing graphdriver: devmapper: Device docker-thinpool is not a thin pool"
I followed all the instructions in https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/.
I see there's a thinpool:
root@tools-docker-builder-01:/home/yuvipanda# lvdisplay --- Logical volume --- LV Name thinpool VG Name docker LV UUID 1OAM1k-H1e5-eE2i-Qwsa-PD92-6ix3-2v12ZY LV Write Access read/write LV Creation host, time tools-docker-builder-01, 2016-07-25 18:28:41 +0000 LV Pool metadata thinpool_tmeta LV Pool data thinpool_tdata LV Status available # open 1 LV Size 133.47 GiB Allocated pool data 0.00% Allocated metadata 0.01% Current LE 34168 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2
On further digging, here's what needs to happen:
- Delete /dev/vda4 which we create to be an lvm partition
- Recreate /dev/vda4 to be an unformatted partition
- *then* follow https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/
This makes it work :)
Now we need to write a script that automates this, and also probably figure out wether we should stick to xfs or switch to ext4
Step 1:
Create a new instance
Step 2:
# parted /dev/vda unit B print Model: Virtio Block Device (virtblk) Disk /dev/vda: 42949672960B Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17408B 1049087B 1031680B primary bios_grub 2 1049088B 536871423B 535822336B linux-swap(v1) swap 3 536871424B 20937948671B 20401077248B ext4 root 4 20937965568B 42948624383B 22010658816B primary lvm
root@tools-docker-test-02:/home/yuvipanda# vgdisplay --- Volume group --- VG Name vd System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 20.50 GiB PE Size 4.00 MiB Total PE 5247 Alloc PE / Size 0 / 0 Free PE / Size 5247 / 20.50 GiB VG UUID vOcWET-Gqhg-rl7I-pNZh-NCST-rxww-grxDha
root@tools-docker-test-02:/home/yuvipanda# lvdisplay root@tools-docker-test-02:/home/yuvipanda#
root@tools-docker-test-02:/home/yuvipanda# pvdisplay --- Physical volume --- PV Name /dev/vda4 VG Name vd PV Size 20.50 GiB / not usable 3.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 5247 Free PE 5247 Allocated PE 0 PV UUID 1zhUuN-mBh4-mfaP-XkvI-3uHz-NKLk-i2NNDj
Step 3:
Cleanup the current VGs.
- vgremove vd
- pvremove /dev/vda4
- vgadisplay -> No volume groups found
- pvdisplay -> Empty
Step 4:
Follow https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/
- pvcreate /dev/vda4
- vgcreate docker /dev/vda4
- lvcreate --wipesignatures y -n thinpool docker -l 95%VG
- lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG
- lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta
- (Skip the autogrow / monitor stuff for now, unnecessary)
This creates a thin pool:
root@tools-docker-test-02:/home/yuvipanda# vgdisplay --- Volume group --- VG Name docker System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 20.50 GiB PE Size 4.00 MiB Total PE 5247 Alloc PE / Size 5088 / 19.88 GiB Free PE / Size 159 / 636.00 MiB VG UUID kfIVWq-8LWe-JvZv-FZHd-U6zl-n2Rk-kdhvbO
root@tools-docker-test-02:/home/yuvipanda# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert thinpool docker twi-a-t--- 19.47g 0.00 0.03
root@tools-docker-test-02:/home/yuvipanda# pvdisplay --- Physical volume --- PV Name /dev/vda4 VG Name docker PV Size 20.50 GiB / not usable 3.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 5247 Free PE 159 Allocated PE 5088 PV UUID wZ55bD-aYEx-sLP2-XaPR-kCSQ-Bnt3-2n1Lvp
root@tools-docker-test-02:/home/yuvipanda# parted /dev/vda unit B print Model: Virtio Block Device (virtblk) Disk /dev/vda: 42949672960B Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17408B 1049087B 1031680B primary bios_grub 2 1049088B 536871423B 535822336B linux-swap(v1) swap 3 536871424B 20937948671B 20401077248B ext4 root 4 20937965568B 42948624383B 22010658816B primary lvm
Starting docker with the appropriate options:
--storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt dm.use_deferred_removal=true
results in failure:
Error starting daemon: error initializing graphdriver: devmapper: Device docker-thinpool is not a thin pool
Step 5:
DESTROY ALL THE THINGS
- vgremove docker
- pvremove /dev/vda4
- parted /dev/vda rm 4
- parted /dev/vda unit B print
Model: Virtio Block Device (virtblk) Disk /dev/vda: 42949672960B Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17408B 1049087B 1031680B primary bios_grub 2 1049088B 536871423B 535822336B linux-swap(v1) swap 3 536871424B 20937948671B 20401077248B ext4 root
Note we only have 3 partitions now!
Step 6:
CREATE FROM SCRATCH
- parted -s /dev/vda mkpart primary 20937948672B 100% (the 20937948672B is the end of the last partition from above +1)
- parted /dev/vda unit B print
Model: Virtio Block Device (virtblk) Disk /dev/vda: 42949672960B Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17408B 1049087B 1031680B primary bios_grub 2 1049088B 536871423B 535822336B linux-swap(v1) swap 3 536871424B 20937948671B 20401077248B ext4 root 4 20937948672B 42949656063B 22011707392B primary
Step 7:
Setup docker thin volume again.
- pvcreate /dev/vda4
- vgcreate docker /dev/vda4
- lvcreate --wipesignatures y -n thinpool docker -l 95%VG
- lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG
- lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta
root@tools-docker-test-02:/home/yuvipanda# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert thinpool docker twi-a-t--- 19.47g 0.00 0.03
root@tools-docker-test-02:/home/yuvipanda# vgdisplay --- Volume group --- VG Name docker System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 20.50 GiB PE Size 4.00 MiB Total PE 5247 Alloc PE / Size 5088 / 19.88 GiB Free PE / Size 159 / 636.00 MiB VG UUID ZkzHFc-43Jf-sx02-jYOy-5ZLQ-zs2S-jEk3SB
root@tools-docker-test-02:/home/yuvipanda# pvdisplay
- Physical volume --- PV Name /dev/vda4 VG Name docker PV Size 20.50 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 5247 Free PE 159 Allocated PE 5088 PV UUID cL463K-g7iB-Kwqt-7B0C-nhwj-wPuW-GrH6Y8
So the last time I tried something akin to this I got docker to work, but this time it didn't - lol? So I'm going to try again tomorrow. Useful debug steps anyway.
That was useful, since that meant that the parted stuff was a red herring. I've a shorter way to get this to work just now:
- vgremove vd
- vgcreate direct-lvm /dev/vda4
- lvcreate --wipesignatures y -n data direct-lvm -l 95%VG
- lvcreate --wipesignatures y -n metadata direct-lvm -l 5%VG
- service docker stop
- --storage-opt dm.datadev=/dev/direct-lvm/data --storage-opt dm.metadatadev=/dev/direct-lvm/metadata params to docker daemon
- service docker start
This still errors, but a reboot fixes it! The difference from the previous thing seems to be primarily that we're specifying datadev and metadatadev separately, and not setting up thin volume ourselves...
No restart solution!
- lvcreate --wipesignatures y -n data vd-l 95%VG
- lvcreate --wipesignatures y -n metadata direct-lvm -l 5%VG
- service docker stop
- rm -rf /var/lib/docker/*
- Add --storage-opt dm.datadev=/dev/vd/data --storage-opt dm.metadatadev=/dev/vd/metadata to systemd params
- Start docker!
So the basica underlying issue seems to be:
- Make sure docker daemon is stopped during this
- Make sure that none of /var/lib/docker that was ever used with loopback driver survive for direct-lvm.
Change 301853 had a related patch set uploaded (by Yuvipanda):
k8s: Use direct-lvm for docker storage backend
Mentioned in SAL [2016-08-01T22:48:34Z] <madhuvishy> Depooling tools-worker-1009 to prepare for T141126
Mentioned in SAL [2016-08-02T00:01:00Z] <yuvipanda> depool tools-worker-1017 for T141126
Mentioned in SAL [2016-08-02T22:41:30Z] <madhuvishy> Depooling tools-worker 1012 and 1013 for T141126
Mentioned in SAL [2016-08-02T22:44:43Z] <yuvipanda> depool tools-worker-1015 for T141126
Mentioned in SAL [2016-08-02T22:49:32Z] <yuvipanda> depooled tools-worker-1014 as well for T141126
Mentioned in SAL [2016-08-03T00:20:46Z] <madhuvishy> Repooled nodes tools-worker 1012 and 1013 for T141126
I'm going to call this done because there are no more worker nodes left with the loopback configuration.