Skip to content

K3d single instance

The host only needs Docker and Git. Run the MVK commands from the container described in Container-first development environment.

Clone the mvk repo from Codeberg so the scripts, files, and manifests are available. We will assume this is under $HOME/projects:

Terminal window
mkdir -p "$HOME/projects"
cd "$HOME/projects"
git clone https://codeberg.org/headshed/mvk.git
cd mvk
Terminal window
cd apps/container
make bin
make up
make shell

make bin fetches the Linux runtime binaries. make up pulls and starts the container, mounting ~/workdir at /home/user/workdir and the checkout at /home/user/workdir/mvk. make shell opens a shell in /home/user/workdir.

From inside the container, create the cluster:

Terminal window
cd mvk
./apps/cli/infra/k3d/scripts/create_k3d_cluster.sh

The cluster is created on the dev-net Docker network shared with the container, and the script points the persisted kubeconfig at the k3d load balancer. If a mycluster cluster already exists from an older configuration, delete it first with k3d cluster delete mycluster.

From inside the container:

Terminal window
k3d cluster list
NAME SERVERS AGENTS LOADBALANCER
mycluster 1/1 0/0 true
Terminal window
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3d-mycluster-server-0 Ready control-plane,master 93m v1.31.5+k3s1

A healthy state and most of the resources may be viewed in several ways, but two good starting points are:

Terminal window
kubectl get events -A
kubectl get all -A

The first lists events logged by the cluster. The second lists the main resources; it is not a complete inventory.

When you are done with this section:

Terminal window
k3d cluster delete mycluster

You can create a new cluster at any time with the script above.