Minikube Tunnel

From Chorke Wiki
Revision as of 02:30, 4 September 2024 by Shahed (talk | contribs) (→‎Systemd File)
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

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

SYSTEM_RAM_LIMIT=$(awk '/^MemTotal:/ { print int($2/1024); }' /proc/meminfo)
SYSTEM_CPU_LIMIT=$(getconf _NPROCESSORS_ONLN)
minikube config view
minikube config
minikube config set memory $((${SYSTEM_RAM_LIMIT}-1024*4))
minikube config set cpus   $((${SYSTEM_CPU_LIMIT}-4))
minikube delete
minikube start

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