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

Commit

Permalink
Re-add EnlargeStoragePool invocation
Browse files Browse the repository at this point in the history
While working on 924bb3b I did not
re-add the `EnlargeStoragePool` invocation and first time users
encountered disk space issues more often again ever since.

Also, add a note to the README and troubleshooting document to tell
users what to do.

Resolves #281
  • Loading branch information
schu committed Jul 9, 2018
1 parent b6e35a7 commit 3d0ce37
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
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

0 comments on commit 3d0ce37

Please sign in to comment.