#cloud-config write_files: - path: /etc/systemd/system/enable-kubelet.service owner: "root:root" permissions: "0644" content: | [Unit] Description=Enable Kubelet [Service] Type=oneshot EnvironmentFile=/etc/sysconfig/heat-params ExecStart=/etc/sysconfig/enable-kubelet-minion.sh [Install] WantedBy=multi-user.target - path: /etc/sysconfig/enable-kubelet-minion.sh owner: "root:root" permissions: "0755" content: | #!/bin/sh if [ -z "${KUBE_NODE_IP}" ]; then KUBE_NODE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) fi if [ -n "${INSECURE_REGISTRY_URL}" ]; then INSECURE_REGISTRY_ARGS="--pod-infra-container-image=${INSECURE_REGISTRY_URL}/google_containers/pause\:3.0" else INSECURE_REGISTRY_ARGS="" fi TLS_CERT_FILE=${KUBE_CERTS_PATH}/worker.pem TLS_PRIVATE_KEY_FILE=${KUBE_CERTS_PATH}/worker-key.pem KUBE_PROTOCOL="https" KUBE_CONFIG="/etc/kubernetes/config/worker-kubeconfig.yaml" if [ "$TLS_DISABLED" == "True" ]; then TLS_CERT_FILE= TLS_PRIVATE_KEY_FILE= KUBE_PROTOCOL="http" KUBE_CONFIG= fi KUBE_MASTER_URI="$KUBE_PROTOCOL://$KUBE_MASTER_IP:$KUBE_API_PORT" HOSTNAME_OVERRIDE=$(hostname --short | sed 's/\.novalocal//') uuid_file="/var/run/kubelet-pod.uuid" CONF_FILE=/etc/systemd/system/kubelet.service cat > $CONF_FILE < $TEMPLATE #!/bin/sh # This is bind mounted into the kubelet rootfs and all rkt shell-outs go # through this rkt wrapper. It essentially enters the host mount namespace # (which it is already in) only for the purpose of breaking out of the chroot # before calling rkt. It makes things like rkt gc work and avoids bind mounting # in certain rkt filesystem dependancies into the kubelet rootfs. This can # eventually be obviated when the write-api stuff gets upstream and rkt gc is # through the api-server. Related issue: # https://github.com/coreos/rkt/issues/2878 exec nsenter -m -u -i -n -p -t 1 -- /usr/bin/rkt "\$@" EOF systemctl enable kubelet systemctl --no-block start kubelet