Install VM with multipass on OS X

Page content

multipass?

Multipass is a lightweight VM manager for Linux, Windows and macOS. It’s designed for developers who want a fresh Ubuntu environment with a single command. It uses KVM on Linux, Hyper-V on Windows and HyperKit on macOS to run the VM with minimal overhead. It can also use VirtualBox on Windows and macOS. Multipass will fetch images for you and keep them up to date.

Since it supports metadata for cloud-init, you can simulate a small cloud deployment on your laptop or workstation.

https://github.com/CanonicalLtd/multipass

Linux 외에 Windows 그리고 Mac OS를 지원하는 multipass를 사용하면 virtualbox를 사용하지 않고도 OS X에서 VM을 쉽게 만들어 linux 기반의 환경을 구성할 수 있다.

아래 예에서는 OS X에서 multipass를 이용해서 Linux(Ubuntu) VM을 생성하고, kubernetes를 설치해 본다.

install multipass with brew

mbpr15:~ cychong$ brew cask install multipass
Updating Homebrew...
...

==> Satisfying dependencies
==> Downloading https://github.com/CanonicalLtd/multipass/releases/download/v0.8.0/multipass-0.8.0+mac-Darwin.pkg
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/114128199/8489a680-ac9c-11e9-99
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'multipass'.
==> Installing Cask multipass
==> Running installer for multipass; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is multipass
installer: Installing at base path /
installer: The install was successful.
🍺  multipass was successfully installed!

Multipass

multipass find

mbpr15:~ cychong$ multipass find
Image                   Aliases           Version          Description
snapcraft:core          core16            20190819         Snapcraft builder for Core 16
snapcraft:core18                          20190820         Snapcraft builder for Core 18
16.04                   xenial            20190814         Ubuntu 16.04 LTS
18.04                   bionic,lts        20190813.1       Ubuntu 18.04 LTS

Create VM

multipass launch

mbpr15:~ cychong$ multipass launch --name vm --mem 4G --disk 20G --cpus 2 
Launched: vm

list VMs

mbpr15:~ cychong$ multipass list
Name                    State             IPv4             Image
vm                      Running           192.168.64.2     Ubuntu 18.04 LTS

execute command in VM from host

mbpr15:~ cychong$ multipass exec vm -- uname -a
Linux vm 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

login to VM

mbpr15:~ cychong$ multipass shell vm
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun Aug 25 20:26:01 KST 2019

  System load:  0.0               Processes:             101
  Usage of /:   5.1% of 19.21GB   Users logged in:       0
  Memory usage: 3%                IP address for enp0s2: 192.168.64.2
  Swap usage:   0%


0 packages can be updated.
0 updates are security updates.


To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

multipass@vm:~$

Setup a single node kubernetes cluster

multipass@vm:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
multipass@vm:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Get:1 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [7889 B]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [485 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [165 kB]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [4976 B]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [2476 B]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [598 kB]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [199 kB]
Get:14 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [4004 B]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2060 B]
Get:16 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [712 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [259 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [11.9 kB]
Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [4156 B]
Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [999 kB]
Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [306 kB]
Get:25 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [6636 B]
Get:26 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [3556 B]
Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2512 B]
Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [1644 B]
Get:29 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4000 B]
Get:30 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1856 B]
Preparing to unpack .../1-aufs-tools_1%3a4.9+20170918-1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:4.9+20170918-1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../2-cgroupfs-mount_1.4_all.deb ...
Unpacking cgroupfs-mount (1.4) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../3-containerd.io_1.2.6-3_amd64.deb ...
Unpacking containerd.io (1.2.6-3) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../4-docker-ce-cli_5%3a19.03.1~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce-cli (5:19.03.1~3-0~ubuntu-bionic) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../5-docker-ce_5%3a19.03.1~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce (5:19.03.1~3-0~ubuntu-bionic) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../6-libltdl7_2.4.6-2_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-2) ...
Setting up aufs-tools (1:4.9+20170918-1ubuntu1) ...
Setting up containerd.io (1.2.6-3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Processing triggers for ureadahead (0.100.0-21) ...
Setting up cgroupfs-mount (1.4) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.25) ...
Setting up libltdl7:amd64 (2.4.6-2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up docker-ce-cli (5:19.03.1~3-0~ubuntu-bionic) ...
Setting up pigz (2.4-1) ...
Setting up docker-ce (5:19.03.1~3-0~ubuntu-bionic) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.25) ...
multipass@vm:~$ sudo swapoff -a
multipass@vm:~$ sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
multipass@vm:~$ sudo apt-get update && sudo apt-get install -y apt-transport-https && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1692 B of archives.
After this operation, 153 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 apt-transport-https all 1.6.11 [1692 B]
Fetched 1692 B in 1s (2906 B/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 60304 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.11_all.deb ...
Unpacking apt-transport-https (1.6.11) ...
Setting up apt-transport-https (1.6.11) ...
OK
multipass@vm:~$ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list && sudo apt-get update
deb http://apt.kubernetes.io/ kubernetes-xenial main
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Get:6 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Get:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [28.9 kB]
Fetched 37.9 kB in 2s (15.3 kB/s)
Reading package lists... Done
multipass@vm:~$ sudo apt-get update && sudo apt-get install -y apt-transport-https && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1692 B of archives.
After this operation, 153 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 apt-transport-https all 1.6.11 [1692 B]
Fetched 1692 B in 1s (2906 B/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 60304 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.11_all.deb ...
Unpacking apt-transport-https (1.6.11) ...
Get:3 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.15.3-00 [20.2 MB]
Get:4 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubectl amd64 1.15.3-00 [8763 kB]
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.15.3-00 [8248 kB]
Fetched 52.9 MB in 27s (1972 kB/s)
Selecting previously unselected package conntrack.
(Reading database ... 60308 files and directories currently installed.)
Preparing to unpack .../0-conntrack_1%3a1.4.4+snapshot20161117-6ubuntu2_amd64.deb ...
Unpacking conntrack (1:1.4.4+snapshot20161117-6ubuntu2) ...
Selecting previously unselected package cri-tools.
Preparing to unpack .../1-cri-tools_1.13.0-00_amd64.deb ...
Unpacking cri-tools (1.13.0-00) ...
Selecting previously unselected package kubernetes-cni.
Preparing to unpack .../2-kubernetes-cni_0.7.5-00_amd64.deb ...
Unpacking kubernetes-cni (0.7.5-00) ...
Selecting previously unselected package socat.
Preparing to unpack .../3-socat_1.7.3.2-2ubuntu2_amd64.deb ...
Unpacking socat (1.7.3.2-2ubuntu2) ...
Selecting previously unselected package kubelet.
Preparing to unpack .../4-kubelet_1.15.3-00_amd64.deb ...
Unpacking kubelet (1.15.3-00) ...
Selecting previously unselected package kubectl.
Preparing to unpack .../5-kubectl_1.15.3-00_amd64.deb ...
Unpacking kubectl (1.15.3-00) ...
Selecting previously unselected package kubeadm.
Preparing to unpack .../6-kubeadm_1.15.3-00_amd64.deb ...
Unpacking kubeadm (1.15.3-00) ...
Setting up conntrack (1:1.4.4+snapshot20161117-6ubuntu2) ...
Setting up kubernetes-cni (0.7.5-00) ...
Setting up cri-tools (1.13.0-00) ...
Setting up socat (1.7.3.2-2ubuntu2) ...
Setting up kubelet (1.15.3-00) ...
Created symlink /etc/systemd/system/multi-user.target.wants/kubelet.service → /lib/systemd/system/kubelet.service.
Setting up kubectl (1.15.3-00) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up kubeadm (1.15.3-00) ...
multipass@vm:~$ sudo kubeadm init --pod-network-cidr=10.201.0.0/24 --token-ttl 0
...

multipass@vm:~$ mkdir -p $HOME/.kube
multipass@vm:~$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
multipass@vm:~$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
multipass@vm:~$ kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                         READY   STATUS    RESTARTS   AGE   IP             NODE     NOMINATED NODE   READINESS GATES
kube-system   coredns-5c98db65d4-ksh4p     0/1     Pending   0          21m   <none>         <none>   <none>           <none>
kube-system   coredns-5c98db65d4-nvvzg     0/1     Pending   0          21m   <none>         <none>   <none>           <none>
kube-system   etcd-vm                      1/1     Running   0          20m   192.168.64.2   vm       <none>           <none>
kube-system   kube-apiserver-vm            1/1     Running   0          20m   192.168.64.2   vm       <none>           <none>
kube-system   kube-controller-manager-vm   1/1     Running   0          20m   192.168.64.2   vm       <none>           <none>
kube-system   kube-proxy-b8qf2             1/1     Running   0          21m   192.168.64.2   vm       <none>           <none>
kube-system   kube-scheduler-vm            1/1     Running   0          20m   192.168.64.2   vm       <none>           <none>

install calico

multipass@vm:~$ wget https://docs.projectcalico.org/v3.8/manifests/calico.yaml
--2019-08-25 21:26:00--  https://docs.projectcalico.org/v3.8/manifests/calico.yaml
Resolving docs.projectcalico.org (docs.projectcalico.org)... 206.189.73.52, 2604:a880:2:d0::21e9:c001
Connecting to docs.projectcalico.org (docs.projectcalico.org)|206.189.73.52|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20628 (20K) [application/x-yaml]
Saving to: ‘calico.yaml’

calico.yaml                  100%[==============================================>]  20.14K  93.2KB/s    in 0.2s

2019-08-25 21:26:02 (93.2 KB/s) - ‘calico.yaml’ saved [20628/20628]

Change CALICO_IPV4POOL_CIDR

            - name: CALICO_IPV4POOL_CIDR
              value: "10.201.0.0/24"
multipass@vm:~$ kubectl apply -f calico.yaml
configmap/calico-config unchanged
customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org unchanged
customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org unchanged
clusterrole.rbac.authorization.k8s.io/calico-kube-controllers unchanged
clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers unchanged
clusterrole.rbac.authorization.k8s.io/calico-node unchanged
clusterrolebinding.rbac.authorization.k8s.io/calico-node unchanged
daemonset.apps/calico-node configured
serviceaccount/calico-node unchanged
deployment.apps/calico-kube-controllers unchanged
serviceaccount/calico-kube-controllers unchanged
multipass@vm:~$ kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE     IP               NODE   NOMINATED NODE   READINESS GATES
kube-system   calico-kube-controllers-65b8787765-5rftm   1/1     Running   0          3m57s   192.168.141.65   vm     <none>           <none>
kube-system   calico-node-dtbhl                          1/1     Running   0          44s     192.168.64.2     vm     <none>           <none>
kube-system   coredns-5c98db65d4-ksh4p                   1/1     Running   0          25m     192.168.141.66   vm     <none>           <none>
kube-system   coredns-5c98db65d4-nvvzg                   1/1     Running   0          25m     192.168.141.67   vm     <none>           <none>
kube-system   etcd-vm                                    1/1     Running   0          24m     192.168.64.2     vm     <none>           <none>
kube-system   kube-apiserver-vm                          1/1     Running   0          24m     192.168.64.2     vm     <none>           <none>
kube-system   kube-controller-manager-vm                 1/1     Running   0          24m     192.168.64.2     vm     <none>           <none>
kube-system   kube-proxy-b8qf2                           1/1     Running   0          25m     192.168.64.2     vm     <none>           <none>
kube-system   kube-scheduler-vm                          1/1     Running   0          25m     192.168.64.2     vm     <none>           <none>
multipass@vm:~$ kubectl taint nodes --all node-role.kubernetes.io/master-
node/vm untainted

Install calicoctl

https://docs.projectcalico.org/v3.5/usage/calicoctl/install

multipass@vm:~$ curl -O -L  https://github.com/projectcalico/calicoctl/releases/download/v3.5.8/calicoctl
multipass@vm:~$ chmod +x calicoctl
multipass@vm:~$ ./calicoctl get profiles
Failed to create Calico API client: no etcd endpoints specified
multipass@vm:~$ kubectl apply -f \
>  https://docs.projectcalico.org/v3.5/getting-started/kubernetes/installation/hosted/calicoctl.yaml
pod/calicoctl created
multipass@vm:~$ kubectl exec -ti -n kube-system calicoctl -- /calicoctl get profiles -o wide
error: unable to upgrade connection: container not found ("calicoctl")
multipass@vm:~$ kubectl get pods --all-namespaces
NAMESPACE     NAME                                       READY   STATUS                       RESTARTS   AGE
kube-system   calico-kube-controllers-65b8787765-5rftm   1/1     Running                      0          10m
kube-system   calico-node-dtbhl                          1/1     Running                      0          7m46s
kube-system   calicoctl                                  0/1     CreateContainerConfigError   0          38s
kube-system   coredns-5c98db65d4-ksh4p                   1/1     Running                      0          33m
kube-system   coredns-5c98db65d4-nvvzg                   1/1     Running                      0          33m
kube-system   etcd-vm                                    1/1     Running                      0          32m
kube-system   kube-apiserver-vm                          1/1     Running                      0          31m
kube-system   kube-controller-manager-vm                 1/1     Running                      0          31m
kube-system   kube-proxy-b8qf2                           1/1     Running                      0          33m
kube-system   kube-scheduler-vm                          1/1     Running                      0          32m
multipass@vm:~$ kubectl describe pod calicoctl --namespace=kube-system
Name:         calicoctl
Namespace:    kube-system
Priority:     0
Node:         vm/192.168.64.2
Start Time:   Sun, 25 Aug 2019 21:35:02 +0900
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"calicoctl","namespace":"kube-system"},"spec":{"containers":[{"command...
Status:       Pending
IP:           192.168.64.2
Containers:
  calicoctl:
    Container ID:
    Image:         calico/ctl:v3.5.8
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/sh
      -c
      while true; do sleep 3600; done
    State:          Waiting
      Reason:       CreateContainerConfigError
    Ready:          False
    Restart Count:  0
    Environment:
      ETCD_ENDPOINTS:  <set to the key 'etcd_endpoints' of config map 'calico-config'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-w2l7q (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-w2l7q:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-w2l7q
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  beta.kubernetes.io/os=linux
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age               From               Message
  ----     ------     ----              ----               -------
  Normal   Scheduled  72s               default-scheduler  Successfully assigned kube-system/calicoctl to vm
  Normal   Pulling    71s               kubelet, vm        Pulling image "calico/ctl:v3.5.8"
  Normal   Pulled     57s               kubelet, vm        Successfully pulled image "calico/ctl:v3.5.8"
  Warning  Failed     3s (x6 over 57s)  kubelet, vm        Error: Couldn't find key etcd_endpoints in ConfigMap kube-system/calico-config
  Normal   Pulled     3s (x5 over 57s)  kubelet, vm        Container image "calico/ctl:v3.5.8" already present on machine

delete kubenetes cluster

multipass@vm:~$ kubectl drain vm --delete-local-data --force --ignore-daemonsets
node/vm cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-dtbhl, kube-system/kube-proxy-b8qf2; deleting Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: kube-system/calicoctl
evicting pod "coredns-5c98db65d4-nvvzg"
evicting pod "calico-kube-controllers-65b8787765-5rftm"
evicting pod "calicoctl"
evicting pod "coredns-5c98db65d4-ksh4p"
pod/calicoctl evicted
pod/coredns-5c98db65d4-nvvzg evicted
pod/calico-kube-controllers-65b8787765-5rftm evicted
pod/coredns-5c98db65d4-ksh4p evicted
node/vm evicted
multipass@vm:~$ sudo kubeadm reset
[reset] Reading configuration from the cluster...
[reset] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
[reset] Are you sure you want to proceed? [y/N]: y
[preflight] Running pre-flight checks
[reset] Removing info for node "vm" from the ConfigMap "kubeadm-config" in the "kube-system" Namespace
W0825 21:46:06.943208    4603 removeetcdmember.go:61] [reset] failed to remove etcd member: error syncing endpoints with etc: etcdclient: no available endpoints
.Please manually remove this etcd member using etcdctl
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[reset] Deleting contents of stateful directories: [/var/lib/etcd /var/lib/kubelet /etc/cni/net.d /var/lib/dockershim /var/run/kubernetes]

The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually.
For example:
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X

If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables.

The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file.

multipass@vm:~$ sudo rm -rf /var/etcd

Reference

multipass