Current kubernetes version: 1.31
Requirements
- Fedora 40
- Podman or Docker
- 5 GB of free disk space
Install
On Fedora ~/local/bin
should be in your $PATH. Copy mok
to that location:
curl --output-dir ~/.local/bin -O https://github.com/bashtools/mok/blob/master/package/mok
chmod +x ~/.local/bin/mok
First use
# Takes around 10 minutes
sudo mok build image
Create a multi node kuberenetes cluster
sudo mok create cluster myk8s --masters 1 --workers 1
Run some kubectl commands
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
Get help
sudo mok -h
sudo mok create -h
Delete the cluster
sudo mok delete cluster myk8s
Uninstall mok completely
rm ~/.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