You can use Multipass to create two Ubuntu VMs and then set up a Kubernetes cluster on these two VMs. It only takes less than 6 minutes.
Terminal iTerm2 pane layout, make sure they all are on the same directory.
+-----------------------+------------------------------------+
| o o o |
+-----------------------+------------------------------------+
| macOS | cks-master |
|=======================|====================================|
| $ pwd | $ pwd |
| /Users/yujunliang | /Users/yujunliang |
| $ # Run Step 1 here. | $ #Run Step 2 here. |
| | $ #Run Step 3 on cks-worker pane. |
| | |
| +------------------------------------+
| | cks-worker |
| |====================================|
| | $ pwd |
| | /Users/yujunliang |
| | $ #Run Step 3 here. |
+-----------------------+------------------------------------+
If you substract the time, it only takes 5 minutes and 26 seconds.
These are the links to install and create kubernetes cluster,
- Download multipass manually.
- Install Container runtimes
- Install kubeadm
- Create a cluster with kubeadm
git clone https://github.com/yujunliang/multipass-kubernetes.git
cd multipass-kubernetes/multipass
./launch-2vm.sh
cd multipass-kubernetes/multipass
./ssh-to-cks-master.sh
when in cks-master VM, execute the following commands
sudo -i
git clone https://github.com/yujunliang/multipass-kubernetes.git
cd multipass-kubernetes/cks-master
./install-all.sh
copy the output like this, and prepare to run it in Step 3.3
kubeadm join 192.168.64.3:6443 --token al0kvi.x60mi1xj4zesqnq3 --discovery-token-ca-cert-hash sha256:f4ff0c7684bbac599a8208b94bb28e451023662ab51bc1ce16f60a855a85e2a5
cd multipass-kubernetes/multipass
./ssh-to-cks-worker.sh
when in cks-worker,execute the following commands
sudo -i
git clone https://github.com/yujunliang/multipass-kubernetes.git
cd multipass-kubernetes/cks-worker
./install-all.sh
then run what you copied from Step 2, something like this,
kubeadm join 192.168.64.3:6443 --token al0kvi.x60mi1xj4zesqnq3 --discovery-token-ca-cert-hash sha256:f4ff0c7684bbac599a8208b94bb28e451023662ab51bc1ce16f60a855a85e2a5
# kubectl get nodes
NAME STATUS ROLES AGE VERSION
cks-master Ready master 34h v1.19.0
cks-worker Ready <none> 34h v1.19.0
# kubectl run nginx --image=nginx
pod/nginx created
# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 19s
After you complete practice, you can delete the VMs. Assume you are still on the same directory as Step 1.
./destroy.sh
Follow me on LinkedIn