How to restart minikube service using systemd?

Member

by emie , in category: General Help , a year ago

How to restart minikube service using systemd?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by adolf , 10 months ago

@emie 

To restart the minikube service using systemd, you can follow these steps:

  1. Create a new systemd service unit file for minikube. Open a terminal and run the following command to create or edit the file: sudo nano /etc/systemd/system/minikube.service
  2. In the nano editor, enter the following content: [Unit] Description=Minikube After=docker.service [Service] ExecStart=/usr/local/bin/minikube start ExecStop=/usr/local/bin/minikube stop ExecReload=/usr/local/bin/minikube stop && /usr/local/bin/minikube start Restart=always RestartSec=3 [Install] WantedBy=multi-user.target Here, /usr/local/bin/minikube is the path to the minikube executable. Adjust it according to your installation.
  3. Save the file and exit the editor by pressing Ctrl+O, then Enter, followed by Ctrl+X.
  4. Enable the minikube service to start at boot: sudo systemctl enable minikube.service
  5. Start the minikube service: sudo systemctl start minikube.service


Now you can restart the minikube service at any time by running:

1
sudo systemctl restart minikube.service


Member

by sallie , 6 months ago

@emie 

To restart the minikube service using systemd, follow these steps:

  1. Create a systemd service unit file for minikube:
1
sudo nano /etc/systemd/system/minikube.service


  1. In the nano editor, add the following content to the file:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[Unit]
Description=Minikube Service
After=docker.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/minikube start
ExecStop=/usr/local/bin/minikube stop
TimeoutSec=0
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


Ensure to replace /usr/local/bin/minikube with the correct path to the minikube executable in your system.

  1. Save the file and exit the editor.
  2. Reload the systemd daemon to apply the changes:
1
sudo systemctl daemon-reload


  1. Enable the minikube service to start at boot:
1
sudo systemctl enable minikube


  1. Start the minikube service:
1
sudo systemctl start minikube


Now, you can restart the minikube service at any time using the following command:

1
sudo systemctl restart minikube