Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Re-add EnlargeStoragePool invocation #283

Merged
merged 1 commit into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ It attempts to mimic production setups by making use of OS containers to set up
## Requirements

* `systemd-nspawn` in at least version 233
* Large enough `/var/lib/machines` partition. kube-spawn will attempt
to enlarge the underlying image `/var/lib/machines.raw` on cluster
start, but this can only succeed when the image is not in use by
another cluster or machine. Not enough disk space is a common source
of error. See [doc/troubleshooting](doc/troubleshooting.md#varlibmachines-partition-too-small) for
instructions on how to increase the size manually.
* `qemu-img`

## Installation
Expand Down
14 changes: 14 additions & 0 deletions doc/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
Here are some common issues that we encountered and how we work around or
fix them. If you discover more, please create an issue or submit a PR.

- [`/var/lib/machines` partition too small](#varlibmachines-partition-too-small)
- [SELinux](#selinux)
- [Restarting machines fails without removing machine images](#restarting-machines-fails-without-removing-machine-images)
- [Running on a version of systemd \< 233](#running-on-a-version-of-systemd--233)
- [kubeadm init looks like it is hanging](#kubeadm-init-looks-like-it-is-hanging)
- [Inotify problems with many nodes](#inotify-problems-with-many-nodes)
- [Issues with ISPs hijacking DNS requests](#issues-with-isps-hijacking-dns-requests)

## `/var/lib/machines` partition too small

Run the following commands to enlarge the storage pool where `POOL_SIZE`
is the disk image size in bytes:

```
# umount /var/lib/machines
# qemu-img resize -f raw /var/lib/machines.raw POOL_SIZE
# mount -t btrfs -o loop /var/lib/machines.raw /var/lib/machines
# btrfs filesystem resize max /var/lib/machines
# btrfs quota disable /var/lib/machines
```

## SELinux

To run `kube-spawn`, it is recommended to turn off SELinux enforcing mode:
Expand Down
8 changes: 8 additions & 0 deletions pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ func (c *Cluster) Start(numberNodes int, cniPluginDir string) error {
return err
}

poolSize, err := bootstrap.GetPoolSize(bootstrap.BaseImageName, numberNodes)
if err != nil {
return err
}
if err := bootstrap.EnlargeStoragePool(poolSize); err != nil {
return err
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down