How to Install Kubernetes on Linux Mint

Linux administrators can build a cluster with Kubernetes and deploy containerized apps inside of it. Kubernetes makes it easy to scale your containerized applications, keep them up to date, and it also provides fault tolerance by distributing the workload across numerous nodes. Installing minikube is one of the simplest methods to begin using Kubernetes.

Minikube makes for a perfect testing environment for developers to see how their containerized application will run on Kubernetes, because it runs a Kubernetes cluster on a single node. In this tutorial, we will show you how to install Kubernetes on a Linux Mint system.

In this tutorial you will learn:

  • How to download and install Minikube on Linux Mint
  • How to install the kubectl command
  • How to interact with your Minikube single node cluster
How to Install Kubernetes on Linux Mint
How to Install Kubernetes on Linux Mint
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Linux Mint
Software Kubernetes
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Kubernetes on Linux Mint step by step instructions



DID YOU KNOW?
In case you would rather install a production ready bootstrapper for Kubernetes, see our tutorial on How to Install Kubernetes on All Linux Distros for instructions on installing kubeadm, as opposed to minikube.
  1. Let’s get started by installing all of the prerequisite packages we are going to need, which is just the curl command and Docker:
    $ sudo apt update
    $ sudo apt install curl docker.io
    
  2. Once Docker has finished installing, use the following commmands to start the service and to make sure it starts automatically after each reboot:
    $ sudo systemctl start docker
    $ sudo systemctl enable docker
    
  3. Next, we need to make sure that swap space is disabled on our system, otherwise Kubernetes will fail to run. Execute the following commands to turn off swap space and permanently disable it with the sed command inside of your /etc/fstab file:
    $ sudo swapoff -a
    $ sudo sed -i '/ swap / s/^/#/' /etc/fstab
    
  4. Next, use the curl command to download the latest version of the Minikube installer:
    $ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
    



  5. After the download completes, use the following dpkg command to install the package:
    $ sudo dpkg -i minikube_latest_amd64.deb
    
  6. After installation, we can launch Minikube with the following command:
    $ minikube start
    

    In some cases, you may find that you need to specify the container manager that you have on your system with the --driver option, such as the following command for Docker:

    $ minikube start --driver=docker
    
  7. Now it is time to install the kubectl command, by executing:
    $ minikube kubectl -- get po -A
    
  8. Then, to save yourself some keystrokes and sanity, create a permanent alias by adding the following line to the ~/.bashrc file:
    alias kubectl="minikube kubectl --"
    
  9. You can now get started with creating your own deployments. Or, if you do not have your own and want to make sure that Minikube is working as intended, we can create a simple deployment and then expose it on port 8000:
    $ kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0
    $ kubectl expose deployment hello-minikube --type=NodePort --port=8000
    
  10. Now we can use the kubectl command to verify that our deployment has launched successfully:
    $ kubectl get services hello-minikube
    


Closing Thoughts

In this tutorial, we saw how to install Kubernetes on a Linux Mint system. Minikube serves as an ideal tool for testing and development purposes by offering a useful starting point to learning Kubernetes. Just keep in mind that it is not a production ready solution, since it can only operate a single node. Despite this limitation, most Linux administrators choose to use Minikube in order to test deployments or get familiar with the ins and outs of Kubernetes.



Comments and Discussions
Linux Forum