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

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.

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:

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).

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

Other add-ons you can install include:

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).

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.

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.