2016-12-20 23:00:46 +00:00
|
|
|
[Unit]
|
|
|
|
Description=Kubernetes Kubelet Server
|
|
|
|
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
|
|
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
|
|
|
|
After=calico-node.service
|
|
|
|
Wants=network.target calico-node.service
|
|
|
|
{% else %}
|
|
|
|
Wants=network.target
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Restart=on-failure
|
|
|
|
RestartSec=10s
|
|
|
|
TimeoutStartSec=0
|
|
|
|
LimitNOFILE=40000
|
|
|
|
|
|
|
|
ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/run/kubelet.uuid
|
|
|
|
ExecStartPre=-/bin/mkdir -p /var/lib/kubelet
|
|
|
|
|
|
|
|
EnvironmentFile={{kube_config_dir}}/kubelet.env
|
|
|
|
# stage1-fly mounts /proc /sys /dev so no need to duplicate the mounts
|
|
|
|
ExecStart=/usr/bin/rkt run \
|
|
|
|
--volume dns,kind=host,source=/etc/resolv.conf \
|
2017-01-10 04:54:01 +00:00
|
|
|
--volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
|
2016-12-20 23:00:46 +00:00
|
|
|
--volume etc-kubernetes,kind=host,source={{ kube_config_dir }},readOnly=false \
|
|
|
|
--volume etc-ssl-certs,kind=host,source=/etc/ssl/certs,readOnly=true \
|
2017-01-10 04:54:01 +00:00
|
|
|
--volume etcd-ssl,kind=host,source={{ etcd_config_dir }},readOnly=true \
|
|
|
|
--volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
|
|
|
|
--volume run,kind=host,source=/run,readOnly=false \
|
2017-02-10 11:50:26 +00:00
|
|
|
{% for dir in ssl_ca_dirs -%}
|
|
|
|
--volume {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},kind=host,source={{ dir }},readOnly=true \
|
|
|
|
{% endfor -%}
|
2016-12-20 23:00:46 +00:00
|
|
|
--volume var-lib-docker,kind=host,source={{ docker_daemon_graph }},readOnly=false \
|
2017-02-10 11:50:26 +00:00
|
|
|
--volume var-lib-kubelet,kind=host,source=/var/lib/kubelet,readOnly=false \
|
2017-01-10 04:54:01 +00:00
|
|
|
--volume var-log,kind=host,source=/var/log \
|
2016-12-20 23:00:46 +00:00
|
|
|
--mount volume=dns,target=/etc/resolv.conf \
|
2017-01-10 04:54:01 +00:00
|
|
|
--mount volume=etc-cni,target=/etc/cni \
|
2016-12-20 23:00:46 +00:00
|
|
|
--mount volume=etc-kubernetes,target={{ kube_config_dir }} \
|
|
|
|
--mount volume=etc-ssl-certs,target=/etc/ssl/certs \
|
2017-01-10 04:54:01 +00:00
|
|
|
--mount volume=etcd-ssl,target={{ etcd_config_dir }} \
|
|
|
|
--mount volume=opt-cni,target=/opt/cni \
|
|
|
|
--mount volume=run,target=/run \
|
2017-02-10 11:50:26 +00:00
|
|
|
{% for dir in ssl_ca_dirs -%}
|
|
|
|
--mount volume={{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }},target={{ dir }} \
|
|
|
|
{% endfor -%}
|
2016-12-20 23:00:46 +00:00
|
|
|
--mount volume=var-lib-docker,target=/var/lib/docker \
|
|
|
|
--mount volume=var-lib-kubelet,target=/var/lib/kubelet \
|
2017-01-10 04:54:01 +00:00
|
|
|
--mount volume=var-log,target=/var/log \
|
2016-12-20 23:00:46 +00:00
|
|
|
--stage1-from-dir=stage1-fly.aci \
|
|
|
|
{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} \
|
|
|
|
--uuid-file-save=/var/run/kubelet.uuid \
|
|
|
|
--debug --exec=/kubelet -- \
|
|
|
|
$KUBE_LOGTOSTDERR \
|
|
|
|
$KUBE_LOG_LEVEL \
|
|
|
|
$KUBELET_API_SERVER \
|
|
|
|
$KUBELET_ADDRESS \
|
|
|
|
$KUBELET_PORT \
|
|
|
|
$KUBELET_HOSTNAME \
|
|
|
|
$KUBE_ALLOW_PRIV \
|
|
|
|
$KUBELET_ARGS \
|
|
|
|
$DOCKER_SOCKET \
|
|
|
|
$KUBELET_REGISTER_NODE \
|
|
|
|
$KUBELET_NETWORK_PLUGIN
|
|
|
|
|
|
|
|
ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/kubelet.uuid
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|