Kind: Integrating kind(1) into a systemd start / stop configuration ...

Created on 30 Mar 2020  路  11Comments  路  Source: kubernetes-sigs/kind

Hi again friends:

I'm trying to wrap kind(1) into Fedora systemd for automatic startup and shutdown.
My kind.service configuration file is shown below, but I notice that it doesn't stay up after it starts. It does stay up when I run the command shown in ExecStart manually, so I know it (and the associated YAML file) work.

I was hoping the Type=forking directive would solve this problem, but it didn't (and so I commented it out).

Might anyone have one of these handy, or see a shortcoming with my configuration below?
Thank you! =:)

[Unit]
Description=Kubernetes-In-Docker (KinD)
After=syslog.target network.target

[Service]
#Type=forking
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/kind.d/bin"
ExecStart=/opt/kind.d/bin/kind create cluster --name myKind --config /opt/kind.d/etc/KinD-config.yml
ExecStop=/opt/kind.d/bin/kind delete cluster --name myKind
StandardOutput=file:/opt/kind.d/var/log/kind.stdout.log
StandardError=file:/opt/kind.d/var/log/kind.stderr.log

[Install]
WantedBy=multi-user.target
kinsupport

Most helpful comment

v0.8.0 is out with host reboot built in.

All 11 comments

I don't think anyone is doing this :-)

It's an interesting idea anyhow.
I believe what you need is a "oneshot" https://www.freedesktop.org/software/systemd/man/systemd.service.html

@BenTheElder I'll try oneshot. When I get it working, I'll post the final service file here for friends to use if they need. Thank you. :)

@BenTheElder By the way, I sent an email to your .dev address. The subject line was a thrilling Hello Ben .... :relaxed: Just an FYI in case you did not receive it.

Sorry, I get a pretty ludicrous amount of email, responses are best effort with variable latency...

No worries bro. I do too. 馃

@BenTheElder FYI: oneshot doesn't appear to work either. I tried it quickly and didn't deep-dive think about why, but will. One possibility (just off the top of my head) is that kind exits and what's left behind are docker containers; not exactly what systemd was expecting. I have to continue to chip away at a solution.

@BenTheElder Actually, this #148 issue fix may enable the systemd service to work for kind.

so #148 fix is in, if you just create a cluster at some point it will start with dockerd, I think you can just let dockerd manage it now unless you have something more specific in mind.

you also won't need to muck with kubeconfig, the same entry will continue working :-)

v0.8.0 is out with host reboot built in.

v0.8.0 is out with host reboot built in.

Thank you for the update! =:)

closing this for now to clear the tracker, feel free to continue discussing and or continue to file issues though 馃槄

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leelavg picture leelavg  路  3Comments

i3oc9i picture i3oc9i  路  3Comments

ivanayov picture ivanayov  路  4Comments

fgimenez picture fgimenez  路  4Comments

philipstaffordwood picture philipstaffordwood  路  4Comments