K3S is a CNCF-certified Kubernetes offering by Rancher that’s designed to be lightweight when compared to K8S.

To achieve this, they removed a lot of extra drivers that weren’t needed as part of the core framework. This makes it easy to install, reduces memory consumption and brings the binary file size under 100 MB

Due to this, K3S is an ideal choice for lot of simple production applications as well as development environments.

You can use it for cases like:

  • Edge devices
  • IOT
  • Development
  • CI

In this post, I’ll explain how you can set up Kubernetes locally with K3S and Multipass.

1 – Setting up Multipass

Multipass is a tool that lets you spin up virtual Ubuntu instances. You can use it with Windows, Mac as well as Linux distros.

To install Multipass, head over to the official website and download the binary for your operating system.

Once the installation is done, you can use Multipass commands to spin up Ubuntu instances.

For example, here’s the command to create an instance named strategically k3s-instance.

$ multipass launch --name k3s-instance

Once the instance is launched, you can also list it using the below command:

$ multipass list

You should see the Ubuntu VM in Running status.

You can also view detailed info about the instance using the info command.

$ multipass info k3s-instance

To install K3S on this Ubuntu Instance, you need to open a terminal within the instance.

This can be done using the below command:

$ multipass shell k3s-instance

2 – Install K3S

K3S provides an easy-to-use installation script.

You can install K3S with this script using the below command:

$ curl -sfL https://get.k3s.io | sh -

After running this command:

  • K3S service is configured automatically to start after node reboots.
  • Additional utilities will be installed such as kubectl
  • A kubeconfig file is created at /etc/rancher/k3s/k3s.yaml. The kubectl will use it.

Note that this will create a fully-functional single-node Kubernetes server installation. It includes the datastore, control plane, kubelet and all the container runtime components necessary to host pods and deployments.

Once the installation is done, you can execute the usual kubectl commands.

$ kubectl get nodes

In case you are looking to create your first pod, check out my post on Kubernetes Pods.

Conclusion

That’s all for this post.

You’ve successfully setup Kubernetes locally with K3S and Multipass.

K3S is an extremely simple way to setup Kubernetes. With Multipass, it becomes even more easy as you can simply create a VM and use Kubernetes on it.

If you have any queries or comments, please feel free to mention them in the comments section below.

Anyways, before we end this post, a quick reminder about the Progressive Code Newsletter where I explain software concepts using a fun approach so that you never forget what you’ve learned. I’m 100% sure you’d love it.

Subscribe now and see you over there.

Categories: BlogKubernetes

Saurabh Dashora

Saurabh is a Software Architect with over 12 years of experience. He has worked on large-scale distributed systems across various domains and organizations. He is also a passionate Technical Writer and loves sharing knowledge in the community.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *