Kubernetes Made Simple with K3S

Kubernetes Made Simple with K3S

Creating a Kubernetes Cluster from scratch seemed like a daunting task to me. And then I discovered the lightweight Kubernetes distribution K3S: Creating a cluster with an on-line command per Node! Here is the tutorial for you to follow along.

This article originally appeared at my blog.

Required Hardware

For this tutorial, you need three different types of hardware.

  • controller: Your laptop/PC to bootstrap the installation
  • k3s-server: A node designated as the server
  • k3s-nodes: Nodes designated as worker

For simplicity, I created cloud computing servers with the following specs.

  • k3s-server: 1 CPU, 2 GB RAM
  • k3s-node1: 2 CPUs, 4GB RAM
  • k3s-node2: 2 CPUs, 4GB RAM

Be sure to have SSH access to each node.

Prepare the Controller

Using MaxOsX, you execute:

Install K3S

Install K3S on the server node first.

Then, install K3S on all worker nodes.

If all goes well, try the kubectl command to see your nodes:

With these steps, the basic Kubernetes installation is done. Did you check your stopwatch?

Install Dashboard

Then install the dashboard.

Store the following configuration in a file called dashboard_accounts.yml.

Then create these roles.

If all goes well, the final steps are to create a local proxy server and get the access token.

Then, access the dashboard in your browser on localhost:8001/api.

Conclusion

This article showed you how to install Kubernetes with the lightweight distribution K3S. With simple one-line shell scripts, you have working cluster in a very short time. If you want to customize this installation, there are lots of [configuration options] you can apply, for example if your containers are executed with containerd or Docker, or whether you want to use Nginx or Traefik as your ingress controller. In the next tutorials, I will show you how the setup TLS encryption for your services, and how to deploy a private Docker registry so you can run private Containers with your Kubernetes.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store