Skip to content

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 7 minutes.

Notifications You must be signed in to change notification settings

yujunliang/multipass-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes Cluster Made Easy by using Multipass!

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.                |
+-----------------------+------------------------------------+

Screenshot

If you substract the time, it only takes 5 minutes and 26 seconds.

Screenshot

Installation steps

These are the links to install and create kubernetes cluster,

  1. Download multipass manually.
  2. Install Container runtimes
  3. Install kubeadm
  4. Create a cluster with kubeadm

Step 1. Create two Ubuntu VMs on macOS pane,

git clone https://github.com/yujunliang/multipass-kubernetes.git
cd multipass-kubernetes/multipass
./launch-2vm.sh

Step 2. On cks-master pane,

2.1 SSH to Ubuntu VM cks-master

cd multipass-kubernetes/multipass
./ssh-to-cks-master.sh

2.2 Install master packages

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

2.3 Copy join command

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

Step 3. On cks-worker pane,

3.1 SSH to Ubuntu VM cks-worker

cd multipass-kubernetes/multipass
./ssh-to-cks-worker.sh

3.2 Install worker packages

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

3.3 Join cks-master as cks-worker

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

Step 4. On second window, cks-master

# 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

Step 5. Delete two Ubuntu VMs on macOS pane,

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

About

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 7 minutes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages