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 Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Ansible and the Pre-Container Arts
  • Kubernetes Cluster Setup on Ubuntu, Explained
  • Zero-Downtime Deployments for Java Apps on Kubernetes
  • Self-Hosted Inference Doesn’t Have to Be a Nightmare: How to Use GPUStack

Trending

  • Introduction to Retrieval Augmented Generation (RAG)
  • You Don't Get to Retrofit Trust: Why API Security Must Be Designed In, Not Bolted On
  • AWS Managed Database Observability: Monitoring DynamoDB, ElastiCache, and Redshift Beyond CloudWatch
  • Why Your DLP Policies Fall Short the Moment AI Agents Enter the Picture
  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?

By 
Chris Ward user avatar
Chris Ward
DZone Core CORE ·
Updated Nov. 21, 19 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
26.2K 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.

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

Kubernetes ubuntu

Opinions expressed by DZone contributors are their own.

Related

  • Ansible and the Pre-Container Arts
  • Kubernetes Cluster Setup on Ubuntu, Explained
  • Zero-Downtime Deployments for Java Apps on Kubernetes
  • Self-Hosted Inference Doesn’t Have to Be a Nightmare: How to Use GPUStack

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook