How to start up minikube automatically via systemd

Jonhnatha Trigueiro
2 min readOct 31, 2021

--

Here is another tip post regarding SOHO server. Now I'm going to teach you guys how to get your minikube starting up automatically using system.d.

Running minikube into my personal server (Screenshot taken on Oct, 31th 2021)

Warming Up: what is minikube?

According Minikube documentation website
(https://minikube.sigs.k8s.io/docs/)

minikube quickly sets up a local Kubernetes cluster on macOS, Linux, and Windows. We proudly focus on helping application developers and new Kubernetes users.

So it's being used for developers and newcomers on K8S. This article doesn't have the intention to show you how to work with kubernetes. I assume you are using minikube for your own tests, so let's advance to what matters;

Why do I need to start up automatically?

For my case, I'm using this small Kubernetes to maintain small services on my home server. (Some ingress routes, some python applications to manage my data and my virtual assistants, gave them another layer of control, VPN connections and so on)

For this objective be accomplished, I needed to keep it simple and resource efficient. But there is a question: how can I keep this starting over in a power loss situation? The answer is: add a script on system.d that does the trick.

Adding Minikube to system.d startup

In order to get it done, please do the steps below:

  • Create a file inside /etc/systemd/system/;
  • Change this file in order to use your own User/Group; (Since minikube was initially configured to work in your own user) [lines 11 and 12]
  • After that run the command to update the systemd unit files:
    # systemctl reload-daemon
  • Now you will be able to enable your newly created systemd service:
    # systemctl enable minikube
    (This will make sure you will have your unit file enabled on startup)

Once you enabled the service, you will be able to run this one at the startup. (I’m using a docker container to run minikube, so that’s why it’s important to add the After statement)

That's it

Have fun!

--

--