How to run minikube start as a Linux service on startup
I want on my home lab lightweight Kubernetes set up which can run AWX, but minikube default can’t automatically start up on boot, so here is a workaround for this issue.
Some parameters :
/usr/lib/systemd/system/minikube.service
[Unit]
Description=minikube
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service
Requires=docker.socket containerd.service docker.service
[Service]
Type=idle
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/de
ExecStart=/home/de/minikube-start.sh
ExecStop=/home/de/minikube-stop.sh
User=de
Group=de
[Install]
WantedBy=multi-user.target
minikube-start.sh
#!/bin/bash
minikube start –addons=ingress –cpus=4 –install-addons=true –memory=6g
nohup minikube tunnel &
minipf-start.sh
#!/bin/bash
sleep 20s
nohup kubectl -n awx port-forward svc/awx-service –address 0.0.0.0 30080:80 &
/usr/lib/systemd/system/miniportf.service
[Unit]
Description=minikube-portforwarding
After=rc-local.service
After=minikube.service
[Service]
Type=idle
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/de
ExecStart=/home/de/minipf-start.sh
User=de
Group=de
[Install]
WantedBy=multi-user.target
chmod +x *.sh
sudo systemctl daemon-reload
sudo systemctl enable miniportf
Views : 607
linux