The kubernetes cluster will 'Evict' Pods if disk space is below 10% (see kubernetes/types.go to see the defaults). My Own Kind images take up about 3.5GB of disk space.
Either Podman or Docker must be installed frst. If both are installed mokctl
will choose to use Docker.
If your distribution enables cgroups v2 then it must be disabled. Only Fedora do this right now, so for Fedora 31 or 32 run the following line then reboot:
grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
See also: Common F31 bugs - Fedora Project Wiki.
As an alternative to installing mokctl
, there is a container image, MokBox, that has mokctl
, kubectl
and docker
already installed, then exec
into the instance to build kubernetes clusters.
Download and run the container image, myownkind/mokbox:
docker run --rm -ti --hostname mokbox --name mokbox \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/tmp:/var/tmp myownkind/mokbox
Then use mokctl
and kubectl
in mokbox:
mokctl build image --get-prebuilt-image
mokctl create cluster myk8s --masters 1
export KUBECONFIG=/var/tmp/admin-myk8s.conf
kubectl get pods -A
Creating an Alias
Add the following to your shell startup file, for example ~/.bashrc
or ~/.zshrc
:
alias mokbox='docker run --rm -ti --hostname mokbox --name mokbox -v /var/run/docker.sock:/var/run/docker.sock -v /var/tmp:/var/tmp myownkind/mokbox';
Then run the work container using: mokbox
.
The base image is Fedora. Additional software can be installed using dnf
, or modify my-own-kind/package/Dockerfile.mokbox
and rebuild the image to have the same tools each time.
Using this method will install the mokctl
command into /usr/local/bin
.
Kubectl wil need to be downloaded separately.
To install from npm:
sudo npm install -g my-own-kind
Then use mokctl
:
alias mokctl="sudo mokctl"
mokctl build image --get-prebuilt-image
mokctl create cluster myk8s --masters 1
Removal
sudo npm uninstall -g my-own-kind
To build and install from source:
git clone https://github.com/mclarkson/my-own-kind.git
cd my-own-kind
Install into /usr/local/bin
:
make test
sudo make install
Then use mokctl
:
mokctl build image --get-prebuilt-image
mokctl create cluster myk8s 1 0
Removal
# To remove mokctl
sudo make uninstall
Also remove the docker images if required:
-
local/mokctl
-
local/mok-centos-7-v1.18.2
-
docker
-
centos