How to get a single-node Kubernetes deployment up in seconds

How do you launch a single-node Kubernetes deployment in seconds? With the help of Microk8s.

How to get a single-node Kubernetes deployment up in seconds How do you launch a single-node Kubernetes deployment in seconds? With the help of Microk8s.

If you have a need for a single-node Kubernetes deployment (for testing or development), you're probably not too keen on having to jump through all the necessary hoops to get this up and running. Fortunately, there's a way to make this happen in seconds. Said method comes by way of and easy-to-install snap package on Linux.

With a single command, you can get that single-node Kubernetes deployment up and running, so you can concentrate your time on development, not deployment.

SEE: Hiring kit: Network administrator (Tech Pro Research)

Let me show you how this is done.

Microk8s

The snap package in question is called Microk8s, a non-elastic, rails-based single-node Kubernetes tool focused on offline development, prototyping, and testing. Microk8s features:

  • Istio
  • GPGPU bindings
  • Daily builds
  • Local storage
  • Local registry
  • Updates
  • Dashboard
  • Metrics
  • Upgrades
  • IngressDNS
  • Conformant

Sold? Let's install.

Installation

The first thing to know is that Microk8s is a snap package, so you need a Linux distribution that supports this universal packaging format. I'll demonstrate on Ubuntu Desktop 19.04. To install, open a terminal window and issue the command:

sudo snap install microk8s —edge —classic

Once the installation completes, you're ready to go.

Usage

The first thing you want to do is start Microk8s. To do this, issue the command:

sudo microk8s.start

With Microk8s started, we can now install additional services (in this case kube-dns and dashboard) with the command:

microk8s.enable dns dashboard

You should see output indicating both services have been started (Figure A).

microk8sa.jpg

Figure A: Kube-DNS and Dashboard are now deployed.

Other add-ons you can install include:

  • storage - allows you to make use of storage on the host.
  • ingress - create an Ingress controller.
  • gpu - enable the nvidia-docker runtime and nvidia-device-plugin-daemonset.
  • istio - enable the core Istio services.
  • registry - deploy a private Docker registry.

Accessing the dashboard

In order to access the Kubernetes Dashboard, you must first find out its associated address. To do this, issue the command:

microk8s.kubctl get all —all-namespaces

In the reported listing, you should see the kubernetes-dashboard listed (Figure B).

microk8sb.jpg

Figure B: The output of our namespaces command.

Point your browser to the IP address listed, and you will arrive at the Kubernetes Dashboard (Figure C), where you can create applications (or any other Kubernetes resource) with a few quick clicks.

microk8sc.jpg

Figure C: Our Kubernetes Dashboard at https://10.152.183.210.

And that's it. Within seconds (maybe minutes, depending on the speed of your network connection and your ability to type quickly) you have a single node Kubernetes deployment, ready for work. It doesn't get much easier than this.

Also see

microk8sa.jpg

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.