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.

102 lines
4.6 KiB

  1. [Unit]
  2. Description=Kubernetes Kubelet Server
  3. Documentation=https://github.com/GoogleCloudPlatform/kubernetes
  4. Wants=network.target
  5. [Service]
  6. Restart=on-failure
  7. RestartSec=10s
  8. TimeoutStartSec=0
  9. LimitNOFILE=40000
  10. ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/run/kubelet.uuid
  11. ExecStartPre=-/bin/mkdir -p /var/lib/kubelet
  12. {% if kubelet_flexvolumes_plugins_dir is defined %}
  13. ExecStartPre=-/bin/mkdir -p {{ kubelet_flexvolumes_plugins_dir }}
  14. {% endif %}
  15. EnvironmentFile={{kube_config_dir}}/kubelet.env
  16. # stage1-fly mounts /proc /sys /dev so no need to duplicate the mounts
  17. ExecStart=/usr/bin/rkt run \
  18. {% if kubelet_load_modules == true %}
  19. --volume modprobe,kind=host,source=/usr/sbin/modprobe \
  20. --volume lib-modules,kind=host,source=/lib/modules \
  21. {% endif %}
  22. --volume os-release,kind=host,source=/etc/os-release,readOnly=true \
  23. --volume hosts,kind=host,source=/etc/hosts,readOnly=true \
  24. --volume dns,kind=host,source=/etc/resolv.conf \
  25. --volume etc-kubernetes,kind=host,source={{ kube_config_dir }},readOnly=false \
  26. --volume etc-ssl-certs,kind=host,source=/etc/ssl/certs,readOnly=true \
  27. --volume etcd-ssl,kind=host,source={{ etcd_config_dir }},readOnly=true \
  28. --volume run,kind=host,source=/run,readOnly=false \
  29. {% for dir in ssl_ca_dirs -%}
  30. --volume {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},kind=host,source={{ dir }},readOnly=true \
  31. {% endfor -%}
  32. --volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \
  33. --volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
  34. --volume var-log,kind=host,source=/var/log \
  35. {% if local_volume_provisioner_enabled == true %}
  36. --volume local-volume-provisioner-base-dir,kind=host,source={{ local_volume_provisioner_base_dir }},readOnly=false,recursive=true \
  37. {% endif %}
  38. {% if kube_network_plugin in ["calico", "weave", "canal", "flannel", "contiv", "cilium"] %}
  39. --volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
  40. --volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
  41. --volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \
  42. {% if kubelet_flexvolumes_plugins_dir is defined %}
  43. --volume flexvolumes,kind=host,source={{ kubelet_flexvolumes_plugins_dir }},readOnly=false \
  44. {% endif %}
  45. {% if kubelet_load_modules == true %}
  46. --mount volume=modprobe,target=/usr/sbin/modprobe \
  47. --mount volume=lib-modules,target=/lib/modules \
  48. {% endif %}
  49. --mount volume=etc-cni,target=/etc/cni \
  50. --mount volume=opt-cni,target=/opt/cni \
  51. --mount volume=var-lib-cni,target=/var/lib/cni \
  52. {% endif %}
  53. --mount volume=os-release,target=/etc/os-release \
  54. --mount volume=dns,target=/etc/resolv.conf \
  55. --mount volume=etc-kubernetes,target={{ kube_config_dir }} \
  56. --mount volume=etc-ssl-certs,target=/etc/ssl/certs \
  57. --mount volume=etcd-ssl,target={{ etcd_config_dir }} \
  58. --mount volume=run,target=/run \
  59. {% for dir in ssl_ca_dirs -%}
  60. --mount volume={{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},target={{ dir }} \
  61. {% endfor -%}
  62. --mount volume=var-lib-docker,target=/var/lib/docker \
  63. --mount volume=var-lib-kubelet,target=/var/lib/kubelet \
  64. --mount volume=var-log,target=/var/log \
  65. --mount volume=hosts,target=/etc/hosts \
  66. {% if local_volume_provisioner_enabled == true %}
  67. --mount volume=local-volume-provisioner-base-dir,target={{ local_volume_provisioner_base_dir }} \
  68. {% endif %}
  69. {% if kubelet_flexvolumes_plugins_dir is defined %}
  70. --mount volume=flexvolumes,target={{ kubelet_flexvolumes_plugins_dir }} \
  71. {% endif %}
  72. --stage1-from-dir=stage1-fly.aci \
  73. {% if kube_hyperkube_image_repo == "docker" %}
  74. --insecure-options=image \
  75. docker://{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
  76. {% else %}
  77. {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
  78. {% endif %}
  79. --uuid-file-save=/var/run/kubelet.uuid \
  80. --debug --exec=/kubelet -- \
  81. $KUBE_LOGTOSTDERR \
  82. $KUBE_LOG_LEVEL \
  83. $KUBELET_API_SERVER \
  84. $KUBELET_ADDRESS \
  85. $KUBELET_PORT \
  86. $KUBELET_HOSTNAME \
  87. $KUBE_ALLOW_PRIV \
  88. $KUBELET_ARGS \
  89. $DOCKER_SOCKET \
  90. $KUBELET_REGISTER_NODE \
  91. $KUBELET_NETWORK_PLUGIN \
  92. $KUBELET_VOLUME_PLUGIN \
  93. $KUBELET_CLOUDPROVIDER
  94. ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/kubelet.uuid
  95. [Install]
  96. WantedBy=multi-user.target