Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Run kubernetes on Mac or Linux in containers

License

NotificationsYou must be signed in to change notification settings

bashtools/mok

image

Default kubernetes version: 1.33.1

Available kubernetes versions:

Minor versionversions
1.31.xnot supported
1.32.x1.32.0, 1.32.1, 1.32.2, 1.32.3, 1.32.4
1.33.x1.33.0, 1.33.1

TL;DR Quick Start

Install:

curl -O https://raw.githubusercontent.com/bashtools/mok/refs/heads/master/package/mokchmod +x moksudo mv mok /usr/local/bin/

Create cluster:

mok build image --get-prebuilt-imagemok create cluster myk8s --masters 1 --publish

Use cluser:

export KUBECONFIG=/var/tmp/admin-myk8s.confkubectl get nodeskubectl get pods --all-namespaceskubectl run --privileged --rm -ti alpine --image alpine /bin/sh

Delete cluster:

mok delete cluster myk8s

Requirements

MacOS

  • Mok will will install any required packages using Homebrew, and will prompt you before doing so.
  • To see exactly how and what will be installed, seesrc/macos.sh.

Fedora Desktop or Server

  • Install Podman.

Install

Installation for Linux and Mac

Usecurl to downloadmok and move it to/usr/local/bin:

curl -O https://raw.githubusercontent.com/bashtools/mok/refs/heads/master/package/mokchmod +x moksudo mv mok /usr/local/bin/

Using Mok

Build a container image

mok build image --get-prebuilt-image

Create a single node kuberenetes cluster

mok create cluster myk8s --masters 1 --publish

For Mac users--publish must be used - but it's optional for Linux users:

Run some kubectl commands

Naturally, thekubectl command is needed for this.

export KUBECONFIG=/var/tmp/admin-myk8s.confkubectl get nodeskubectl get pods --all-namespaces
# --privileged is required if you want to `ping` a hostkubectl run --privileged --rm -ti alpine --image alpine /bin/sh

Get help

mok -hmok create -hmok build -hmok machine -h# ... etc ...

Delete the cluster

mok delete cluster myk8s

On Mac OS do,mok machine stop, to stop the podman machine and free up resources.

To Uninstall mok completely

Mac

mok machine destroy

Ifmok installed Homebrew, then remove homebrew and all its installed packages with:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

Then to completely remove any left over directories run:

sudo rm -rf /opt/homebrew

Finally, deletemok, with:

sudo rm /usr/local/bin/mok

Linux

sudo rm /usr/local/bin/mok# If you used git and make, then delete the git reporm -rf mok/

Then delete the podman images that were built bymok build.

Known Issues

  • With multiple master nodes only the first master is set up
  • Currently only single node clusters can be stopped and restarted
  • For Mac, if you installed Homebrew withmok then you should run/opt/homebrew/bin/brew doctor and follow the instructions shown there ifyou want to use Homebrew outside of Mok, or if you want to run the utilitiesthat mok installed (podman for example).

Some Features

  • Podman Desktop is not required

  • On Mac OS all the required packages are installed for you

  • On Mac OS it uses a non-default podman machine, so won't mess up your existing podman installation

  • 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 (seekthwic)
  • mok build andmok create can show extensive kubernetes logs with--tailf

  • Full Documentation

Support Mok

FollowMok on BlueSky or give Mok a star.

About

Run kubernetes on Mac or Linux in containers

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp