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.

75 lines
3.3 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 os-release,kind=host,source=/etc/os-release,readOnly=true \
  21. --volume dns,kind=host,source=/etc/resolv.conf \
  22. --volume etc-kubernetes,kind=host,source={{ kube_config_dir }},readOnly=false \
  23. --volume etc-ssl-certs,kind=host,source=/etc/ssl/certs,readOnly=true \
  24. --volume etcd-ssl,kind=host,source={{ etcd_config_dir }},readOnly=true \
  25. --volume run,kind=host,source=/run,readOnly=false \
  26. {% for dir in ssl_ca_dirs -%}
  27. --volume {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},kind=host,source={{ dir }},readOnly=true \
  28. {% endfor -%}
  29. --volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \
  30. --volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false \
  31. --volume var-log,kind=host,source=/var/log \
  32. {% if kube_network_plugin in ["calico", "weave", "canal"] %}
  33. --volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
  34. --volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
  35. --volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \
  36. --mount volume=etc-cni,target=/etc/cni \
  37. --mount volume=opt-cni,target=/opt/cni \
  38. --mount volume=var-lib-cni,target=/var/lib/cni \
  39. {% endif %}
  40. --mount volume=os-release,target=/etc/os-release \
  41. --mount volume=dns,target=/etc/resolv.conf \
  42. --mount volume=etc-kubernetes,target={{ kube_config_dir }} \
  43. --mount volume=etc-ssl-certs,target=/etc/ssl/certs \
  44. --mount volume=etcd-ssl,target={{ etcd_config_dir }} \
  45. --mount volume=run,target=/run \
  46. {% for dir in ssl_ca_dirs -%}
  47. --mount volume={{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},target={{ dir }} \
  48. {% endfor -%}
  49. --mount volume=var-lib-docker,target=/var/lib/docker \
  50. --mount volume=var-lib-kubelet,target=/var/lib/kubelet \
  51. --mount volume=var-log,target=/var/log \
  52. --stage1-from-dir=stage1-fly.aci \
  53. {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
  54. --uuid-file-save=/var/run/kubelet.uuid \
  55. --debug --exec=/kubelet -- \
  56. $KUBE_LOGTOSTDERR \
  57. $KUBE_LOG_LEVEL \
  58. $KUBELET_API_SERVER \
  59. $KUBELET_ADDRESS \
  60. $KUBELET_PORT \
  61. $KUBELET_HOSTNAME \
  62. $KUBE_ALLOW_PRIV \
  63. $KUBELET_ARGS \
  64. $DOCKER_SOCKET \
  65. $KUBELET_REGISTER_NODE \
  66. $KUBELET_NETWORK_PLUGIN \
  67. $KUBELET_CLOUDPROVIDER
  68. ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/kubelet.uuid
  69. [Install]
  70. WantedBy=multi-user.target