Current kubernetes version: 1.31
- Fedora 40
- Podman or Docker
- 5 GB of free disk space
Use curl
and download mok
to /usr/local/bin
:
curl -O https://raw.githubusercontent.com/bashtools/mok/refs/heads/master/package/mok
chmod +x mok
sudo mv mok /usr/local/bin/
or use git
and make
and install to /usr/local/bin
:
git clone https://github.com/bashtools/mok.git
cd mok
sudo make install
# Takes around 10 minutes
sudo mok build image
sudo mok create cluster myk8s --masters 1 --workers 1
export KUBECONFIG=/var/tmp/admin-myk8s.conf
kubectl get nodes
kubectl get pods --all-namespaces
# --privileged is required if you want to `ping`
kubectl run --privileged --rm -ti alpine --image alpine /bin/sh
sudo mok -h
sudo mok create -h
sudo mok delete cluster myk8s
rm ~/.local/bin/mok
# or
rm -rf mok/
sudo rm /usr/local/bin/mok
Then delete the podman/docker images that were built by mok build
.
- With multiple master nodes only the first master is set up
-
Builds kubernetes master and worker nodes in containers
-
Very simple to use without need for YAML files
-
After creating the image a single node cluster builds in under 60 seconds
-
For multi-node clusters the 'create cluster' command returns only when kubernetes is completely ready, with all nodes and pods up and ready.
-
Can skip setting up kubernetes on the master and/or worker node (good for learning!)
- In this case the set-up scripts are placed in
/root
in the containers and can be run by hand - Can do kubernetes the hard way (see kthwic)
- In this case the set-up scripts are placed in
-
mok build
andmok create
can show extensive logs with--tailf