Giter VIP home page Giter VIP logo

multipass-kubernetes's Introduction

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

multipass-kubernetes's People

Contributors

yujunliang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

multipass-kubernetes's Issues

./install.sh throws Unable to connect to the server ERROR

In cks-master :
Once i launch your scripts everything works well until the ./install-all.sh. here the command kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" throws this error:
Unable to connect to the server: dial tcp: lookup cloud.weave.works on 127.0.0.53:53: no such host
kubectl get nodes returns the master node in a NotReady state :

NAME         STATUS     ROLES                  AGE   VERSION
cks-master   NotReady   control-plane,master   10m   v1.20.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.