2018-03-25 09:08:03 +02:00
|
|
|
#cloud-config
|
|
|
|
yum_repos:
|
|
|
|
kubernetes:
|
|
|
|
name: kubernetes
|
|
|
|
baseurl: https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
|
|
|
|
enabled: true
|
|
|
|
gpgcheck: true
|
|
|
|
gpgkey: https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
|
|
|
|
packages:
|
2018-03-31 22:11:42 +02:00
|
|
|
- [docker, 1.13.1]
|
|
|
|
- [kubelet, 1.10.0]
|
2018-03-25 09:08:03 +02:00
|
|
|
- nfs-utils
|
|
|
|
write_files:
|
|
|
|
- path: /etc/systemd/system/cloud-metadata.service
|
|
|
|
content: |
|
|
|
|
[Unit]
|
|
|
|
Description=Digital Ocean metadata agent
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
|
|
|
Environment=OUTPUT=/run/metadata/digitalocean
|
|
|
|
ExecStart=/usr/bin/mkdir -p /run/metadata
|
|
|
|
ExecStart=/usr/bin/bash -c 'echo "DIGITALOCEAN_IPV4_PUBLIC_0=$(curl\
|
|
|
|
--url http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address\
|
|
|
|
--retry 10)\nDIGITALOCEAN_IPV4_PRIVATE_0=$(curl\
|
|
|
|
--url http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address\
|
|
|
|
--retry 10)" > $${OUTPUT}'
|
|
|
|
- path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
|
|
|
|
content: |
|
|
|
|
[Unit]
|
|
|
|
Description=Kubelet
|
|
|
|
Requires=cloud-metadata.service
|
|
|
|
After=cloud-metadata.service
|
|
|
|
Wants=rpc-statd.service
|
|
|
|
[Service]
|
|
|
|
EnvironmentFile=/run/metadata/digitalocean
|
|
|
|
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"
|
|
|
|
ExecStart=
|
|
|
|
ExecStart=/usr/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=$${DIGITALOCEAN_IPV4_PRIVATE_0} \
|
|
|
|
--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
|
|
|
|
content: |
|
|
|
|
SELINUX=permissive
|
|
|
|
runcmd:
|
|
|
|
- [systemctl, daemon-reload]
|
|
|
|
- [systemctl, enable, docker.service]
|
|
|
|
- [systemctl, start, --no-block, docker.service]
|
|
|
|
- [systemctl, enable, cloud-metadata.service]
|
|
|
|
- [systemctl, enable, kubelet.path]
|
|
|
|
- [systemctl, start, --no-block, kubelet.path]
|
|
|
|
users:
|
|
|
|
- default
|
|
|
|
- name: fedora
|
|
|
|
gecos: Fedora Admin
|
|
|
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
|
|
groups: wheel,adm,systemd-journal,docker
|
|
|
|
ssh-authorized-keys:
|
|
|
|
- "${ssh_authorized_key}"
|