73 lines
2.7 KiB
Cheetah
73 lines
2.7 KiB
Cheetah
|
#cloud-config
|
||
|
write_files:
|
||
|
- path: /etc/systemd/system/kubelet.service
|
||
|
content: |
|
||
|
[Unit]
|
||
|
Description=Kubelet
|
||
|
Wants=rpc-statd.service
|
||
|
[Service]
|
||
|
WorkingDirectory=/etc/kubernetes
|
||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
|
||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
|
||
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||
|
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
||
|
# Atomic's system containers and RPMs are old and unfriendly. Use this.
|
||
|
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz
|
||
|
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet
|
||
|
ExecStart=
|
||
|
ExecStart=/usr/local/bin/kubelet \
|
||
|
--allow-privileged \
|
||
|
--anonymous-auth=false \
|
||
|
--cgroup-driver=systemd \
|
||
|
--client-ca-file=/etc/kubernetes/ca.crt \
|
||
|
--cluster_dns=${k8s_dns_service_ip} \
|
||
|
--cluster_domain=${cluster_domain_suffix} \
|
||
|
--cni-conf-dir=/etc/kubernetes/cni/net.d \
|
||
|
--exit-on-lock-contention \
|
||
|
--hostname-override=${domain_name} \
|
||
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||
|
--lock-file=/var/run/lock/kubelet.lock \
|
||
|
--network-plugin=cni \
|
||
|
--node-labels=node-role.kubernetes.io/node \
|
||
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||
|
Restart=always
|
||
|
RestartSec=10
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|
||
|
- path: /etc/systemd/system/kubelet.path
|
||
|
content: |
|
||
|
[Unit]
|
||
|
Description=Watch for kubeconfig
|
||
|
[Path]
|
||
|
PathExists=/etc/kubernetes/kubeconfig
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|
||
|
- path: /etc/kubernetes/.keep
|
||
|
- path: /etc/selinux/config
|
||
|
owner: root:root
|
||
|
permissions: '0644'
|
||
|
content: |
|
||
|
SELINUX=permissive
|
||
|
SELINUXTYPE=targeted
|
||
|
bootcmd:
|
||
|
- [setenforce, Permissive]
|
||
|
runcmd:
|
||
|
- [systemctl, daemon-reload]
|
||
|
- [hostnamectl, set-hostname, ${domain_name}]
|
||
|
- [systemctl, enable, kubelet.path]
|
||
|
- [systemctl, start, --no-block, kubelet.path]
|
||
|
- [systemctl, disable, firewalld, --now]
|
||
|
users:
|
||
|
- default
|
||
|
- name: fedora
|
||
|
gecos: Fedora Admin
|
||
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||
|
groups: wheel,adm,systemd-journal,docker
|
||
|
ssh-authorized-keys:
|
||
|
- "${ssh_authorized_key}"
|