Secret IT Engineer

Blogs you've never heard of

MultiPass Kubernetes Cluster Bring-Up Pt1

So I recently got a new mac mini, and wanted a lightweight way to deploy a K8s cluster, not using minikube, or any other cut down version, I wanted to run a small production full scale cluster… the following script below will deploy 3 nodes, add the current user’s SSH Public key to the new node.. there are some other commands in there like adding an NFS Mountpoint and logging stuff, but these are mainly for the next phase which will be in another post.

 

 

#! /bin/sh

 

mv .ssh/known_hosts .ssh/known_hosts_old

 

multipass launch -n Kube1 -c 2 -d 20G -m 2048m –network name=en0 –cloud-init – <<EOF

ssh_authorized_keys:

– $( cat ~/.ssh/id_rsa.pub )

runcmd:

– sudo apt install -y nfs-common

– sudo mkdir /mnt/synserver/

– sudo mount -o soft,intr,rsize=8192,wsize=8192 <mount NFS path> /mnt/synserver/

– logs=/mnt/synserver/Lab/Scripts/Kuberbetes/Logs

– sudo ip route del default

EOF

 

multipass launch -n Kube2 -c 2 -d 20G -m 2048m –network name=en0 –cloud-init – <<EOF

ssh_authorized_keys:

– $( cat ~/.ssh/id_rsa.pub )

runcmd:

– sudo apt install -y nfs-common

– sudo mkdir /mnt/synserver/

– sudo mount -o soft,intr,rsize=8192,wsize=8192 <mount NFS path> /mnt/synserver/

– logs=/mnt/synserver/Lab/Scripts/Kuberbetes/Logs

– sudo ip route del default

EOF

 

multipass launch -n Kube3 -c 2 -d 20G -m 2048m –network name=en0 –cloud-init – <<EOF

ssh_authorized_keys:

– $( cat ~/.ssh/id_rsa.pub )

runcmd:

– sudo apt install -y nfs-common

– sudo mkdir /mnt/synserver/

– sudo mount -o soft,intr,rsize=8192,wsize=8192 <mount NFS path> /mnt/synserver/

– logs=/mnt/synserver/Lab/Scripts/Kuberbetes/Logs

– sudo ip route del default

EOF

 

If you are feeling adventurous, use the following to create additional nics..  the network’s can be different.

multipass stop Kube1

sudo VBoxManage modifyvm Kube1 –nic2 bridged –bridgeadapter2 en0

multipass start Kube1

multipass exec — Kube1 sudo bash -c “cat > /etc/netplan/60-bridge.yaml” <<EOF

network:

ethernets:

enp0s8: # this is the interface name from above

dhcp4: true

dhcp4-overrides: # this is needed so the default gateway

route-metric: 200 # remains with the first interface

version: 2

EOF

$ multipass exec Kube1 sudo netplan apply

 


 

Published by

Leave a comment