DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Multipass and MicroK8s: the Quickest Route to Ubuntu and Kubernetes?

Multipass and MicroK8s: the Quickest Route to Ubuntu and Kubernetes?

Would your Kubernetes-based workflows run better on Multipass and MicroK8s?

Chris Ward user avatar by
Chris Ward
CORE ·
Nov. 21, 19 · Tutorial
Like (6)
Save
Tweet
Share
24.59K Views

Join the DZone community and get the full member experience.

Join For Free

Image title

Are Multipass and MicroK8s legitimate shortcuts to Ubuntu and Kubernetes?

In my recent interview with Carmine Rimi of Canonical, he mentioned Multipass and MicroK8s as alternatives to Docker for running Kubernetes-based workflows on a development machine. As a long-term user of Docker for Desktop (Mac), I was intrigued to see what alternatives it might offer.

You may also enjoy:  How to Install and Deploy Kubernetes on Ubuntu 16.04

To clarify, Multipass is the lightweight VM manager that everything else runs on top of. It only runs Ubuntu-based images and works with your OS-native hypervisor, or Virtualbox on Windows and macOS.

Installation

Multipass

I’m a macOS user, so fired up homebrew to first install Multipass, but snaps are available, and binaries for Windows:

brew cask install multipass


Next, you can search for images with the find command which returns a list of the available images (four at the time of writing):

multipass find

To launch the most up to date image, use the multipass launch ubuntu command, or to specify a version, replace “ubuntu” with a version from the find output above, or an image URL. For example, to launch Ubtunu 16.04, use multipass launch 16.04.


Then to connect to a running instance. First, find its instance name with the list option, and then use the shell option, specifying the image. For example:

$ multipass list

Name                    State             IPv4             Image
close-willet            Running           192.168.64.4     Ubuntu 16.04 LTS
rewarded-stud           Running           192.168.64.3     Ubuntu 18.04 LTS


Then:

multipass shell rewarded-stud


You can also run commands in an instance indirectly without connecting directly to the instance with the exec option, and the command separated with a double dash (--), for example:

multipass exec rewarded-stud -- ls -a


Then stop and delete an instance with the stop and delete options respectively:

multipass stop rewarded-stud
multipass delete rewarded-stud


This still leaves a few remnants behind, to completely remove all deleted instances and images, use multipass purge.

MicroK8s

Here’s where things get interesting. There’s no additional package to install on your host machine (if you’re running macOS or Windows), you install MicroK8s as a snap on your Multipass-hosted Ubuntu instance.

Connect to an instance as detailed above, then run the following inside the instance:

sudo snap install microk8s --classic


Then start MicroK8 with:

sudo microk8s.start


Alternatively, start MicroK8 without connecting to the instance using:

multipass exec intrigued-kudu -- /snap/bin/microk8s.start


OK, great, but this is fiddly from the host machine, it would be preferable to use something like kubectl.

First, you need to add the multipass user to the microk8s group, so it has permissions to run and access the services needed:

multipass exec intrigued-kudu -- sudo usermod -a -G microk8s multipass


Next, copy the kubeconfig file from the instance:

multipass exec intrigued-kudu -- /snap/bin/microk8s.config > kubeconfig


Then use the new config to access Kubernetes running on the instance:

kubectl --kubeconfig=kubeconfig get all --all-namespaces


You can see what services are running on the Kubernetes cluster with:

$ multipass exec intrigued-kudu -- /snap/bin/microk8s.kubectl cluster-info

Kubernetes master is running at https://127.0.0.1:16443
Heapster is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/heapster/proxy
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Grafana is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
InfluxDB is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-influxdb:http/proxy


Replace “127.0.0.1” with the IP of the VM, and you should be able to access services as usual.

From Development to Production

So far, so good, but what benefit does this bring over any existing workflow you may have already? Canonical argues that multipass gives you access to the same images they supply to cloud providers, giving you a consistent environment from development to production. There are other ways to find and use these images with other tools, and many may argue that they don’t need that consistency.

If you’re happy to add another tool alongside (or instead of) anything else you are using (and only need Ubuntu images), then Multipass uses minimal CPU and disk space and guarantees you reliable images that match more than 30% of those used on the cloud.

Further Reading


Dockerless, Part 1: Which Tools to Replace Docker With and How

Draft vs. Skaffold: Developing on Kubernetes

Kubernetes ubuntu

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Select ChatGPT From SQL? You Bet!
  • ChatGPT: The Unexpected API Test Automation Help
  • Top 5 Java REST API Frameworks
  • How To Create and Edit Excel XLSX Documents in Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: