You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
3.1 KiB

  1. [Unit]
  2. Description=Kubernetes Kubelet Server
  3. Documentation=https://github.com/GoogleCloudPlatform/kubernetes
  4. {% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
  5. After=calico-node.service
  6. Wants=network.target calico-node.service
  7. {% else %}
  8. Wants=network.target
  9. {% endif %}
  10. [Service]
  11. Restart=on-failure
  12. RestartSec=10s
  13. TimeoutStartSec=0
  14. LimitNOFILE=40000
  15. ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/run/kubelet.uuid
  16. ExecStartPre=-/bin/mkdir -p /var/lib/kubelet
  17. EnvironmentFile={{kube_config_dir}}/kubelet.env
  18. # stage1-fly mounts /proc /sys /dev so no need to duplicate the mounts
  19. ExecStart=/usr/bin/rkt run \
  20. --volume dns,kind=host,source=/etc/resolv.conf \
  21. --volume etc-kubernetes,kind=host,source={{ kube_config_dir }},readOnly=false \
  22. --volume etc-ssl-certs,kind=host,source=/etc/ssl/certs,readOnly=true \
  23. --volume etcd-ssl,kind=host,source={{ etcd_config_dir }},readOnly=true \
  24. --volume run,kind=host,source=/run,readOnly=false \
  25. {% for dir in ssl_ca_dirs -%}
  26. --volume {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},kind=host,source={{ dir }},readOnly=true \
  27. {% endfor -%}
  28. --volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \
  29. --volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false \
  30. --volume var-log,kind=host,source=/var/log \
  31. {% if kube_network_plugin in ["calico", "weave", "canal"] %}
  32. --volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
  33. --volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
  34. --volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \
  35. --mount volume=etc-cni,target=/etc/cni \
  36. --mount volume=opt-cni,target=/opt/cni \
  37. --mount volume=var-lib-cni,target=/var/lib/cni \
  38. {% endif %}
  39. --mount volume=dns,target=/etc/resolv.conf \
  40. --mount volume=etc-kubernetes,target={{ kube_config_dir }} \
  41. --mount volume=etc-ssl-certs,target=/etc/ssl/certs \
  42. --mount volume=etcd-ssl,target={{ etcd_config_dir }} \
  43. --mount volume=run,target=/run \
  44. {% for dir in ssl_ca_dirs -%}
  45. --mount volume={{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},target={{ dir }} \
  46. {% endfor -%}
  47. --mount volume=var-lib-docker,target=/var/lib/docker \
  48. --mount volume=var-lib-kubelet,target=/var/lib/kubelet \
  49. --mount volume=var-log,target=/var/log \
  50. --stage1-from-dir=stage1-fly.aci \
  51. {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
  52. --uuid-file-save=/var/run/kubelet.uuid \
  53. --debug --exec=/kubelet -- \
  54. $KUBE_LOGTOSTDERR \
  55. $KUBE_LOG_LEVEL \
  56. $KUBELET_API_SERVER \
  57. $KUBELET_ADDRESS \
  58. $KUBELET_PORT \
  59. $KUBELET_HOSTNAME \
  60. $KUBE_ALLOW_PRIV \
  61. $KUBELET_ARGS \
  62. $DOCKER_SOCKET \
  63. $KUBELET_REGISTER_NODE \
  64. $KUBELET_NETWORK_PLUGIN \
  65. $KUBELET_CLOUDPROVIDER
  66. ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/kubelet.uuid
  67. [Install]
  68. WantedBy=multi-user.target