Search code examples
kubernetessystemdcoreos

How to download Kubernetes with Systemd at CoreOS


I am provisioning a cluster of CoreOS machines. But I am having trouble downloading the kubernetes tar ball because of its size (~450MB). I have managed to use this same techinique to download the latest etcd2, fleet and flannel, but when downloading such a big file as kubernetes my service fails or stop without any stack strace. It think is something related with the fact systemd is neither waiting nor restarting the service as I would expect.This is my service file:

   [Unit]
      Description=updates kubernetes v1.2

      [Service]
      Type=oneshot
      User=root
      WorkingDirectory=/home/core
      ExecStart=/usr/bin/mkdir -p /opt/bin
      ExecStart=/usr/bin/mkdir -p /home/core/kubernetes
      ExecStart=/bin/wget https://github.com/kubernetes/kubernetes/releases/download/v1.2.0/kubernetes.tar.gz
      ExecStart=/usr/bin/tar zxf /home/core/kubernetes  -C /home/core/kubernetes --strip-components=1
      ExecStart=/usr/bin/mv kubernetes/platforms/linux/amd64/kubectl /opt/bin/kubectl
      ExecStart=/usr/bin/tar zxf kubernetes/server/kubernetes-server-linux-amd64.tar.gz
      ExecStart=/usr/bin/chmod a+x kubernetes/server/bin/*
      ExecStart=/usr/bin/mv kubernetes/server/bin/* /opt/bin
      ExecStart=/usr/bin/rm -f /home/core/kubernetes

Solution

  • I bet you need to set/increase the TimeoutStartSec= parameter which is probably defaulted to 30 seconds or something like that.