- Create an empty file and paste the content bellow into it /lib/systemd/system/kubectlproxy.service
[Unit]
Description=kubectl proxy 8080
After=network.target
[Service]
User=root
ExecStart=/bin/bash -c "/usr/bin/kubectl proxy --address=127.0.0.1 --port=8080"
StartLimitInterval=0
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
- Restart the server
- Check the service status
systemctl -l status kubectlproxy.service
- If the service is not enabled (error bellow)
kubectl-proxy.service - kubectl proxy 8080
Loaded: loaded (/lib/systemd/system/kubectl-proxy.service; disabled; vendor preset: enabled)
Active: inactive (dead)
enable it by this command systemctl enable kubectlproxy.service
Notes If you modify the configuration of the service after start you need to run the following
systemctl daemon-reload
systemctl reenable kubectlproxy.service
systemctl restart kubectlproxy.service
@Trackhe Run it with 0.0.0.0 instead of 127.0.0.1