Minikube Tunnel

From Chorke Wiki
Revision as of 23:02, 18 December 2024 by Shahed (talk | contribs) (→‎References)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
sudo -i -u minikube
minikube tunnel --cleanup
minikube tunnel --cleanup=true
minikube status -ojson|jq -r .

Systemd

Line number: 19 meaningless, kept backed those lines for identical purpose

cat << INI | sudo tee /etc/systemd/system/minikube-tunnel.service >/dev/null
[Unit]
Description=Minikube Tunnel
Documentation=https://minikube.sigs.k8s.io/docs/commands/tunnel/
After=network-online.target containerd.service docker.service minikube.service
Requires=network-online.target containerd.service docker.service minikube.service
Wants=network-online.target docker.service minikube.service
AssertFileIsExecutable=/var/minikube/bin/minikube

[Service]
User=minikube
Group=minikube
ProtectProc=invisible
StandardOutput=journal
WorkingDirectory=/var/minikube

EnvironmentFile=-/etc/default/minikube
ExecStart=/var/minikube/bin/minikube tunnel --cleanup=true
ExecStartPost=/bin/bash -c "echo ${MAINPID} > /var/minikube/etc/tunnel.pid"

Restart=always
SendSIGKILL=no
TasksMax=infinity
TimeoutStopSec=infinity

[Install]
WantedBy=multi-user.target
INI

Playground

# check minikube user either exists or not
cat /etc/passwd|grep minikube
sudo usermod -aG sudo minikube
# minikube no-password sudo access add to EOL
sudo visudo
minikube ALL=(ALL) NOPASSWD: ALL
# login to minikube user and start tunneling
sudo -i -u minikube
minikube tunnel

sudo systemctl enable  --now  minikube-tunnel.service
sudo systemctl disable --now  minikube-tunnel.service
systemctl status minikube-tunnel.service
journalctl -xeu  minikube-tunnel.service
sudo systemctl stop  minikube-tunnel.service
sudo systemctl start minikube-tunnel.service

docker network prune -f
docker volume  prune -f
docker system  prune -f
docker image ls
cat <<'EXE' | bash
for d in system network volume
do docker ${d} prune -f;done
EXE
cat <<'EXE' | ssh [email protected]
for d in system network volume
do docker ${d} prune -f;done
EXE

References