2018-03-25 09:08:03 +02:00
|
|
|
#cloud-config
|
|
|
|
write_files:
|
|
|
|
- path: /etc/etcd/etcd.conf
|
|
|
|
content: |
|
|
|
|
ETCD_NAME=${etcd_name}
|
|
|
|
ETCD_DATA_DIR=/var/lib/etcd
|
|
|
|
ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379
|
|
|
|
ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380
|
|
|
|
ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:2379
|
|
|
|
ETCD_LISTEN_PEER_URLS=https://0.0.0.0:2380
|
|
|
|
ETCD_INITIAL_CLUSTER=${etcd_initial_cluster}
|
|
|
|
ETCD_STRICT_RECONFIG_CHECK=true
|
|
|
|
ETCD_TRUSTED_CA_FILE=/etc/ssl/certs/etcd/server-ca.crt
|
|
|
|
ETCD_CERT_FILE=/etc/ssl/certs/etcd/server.crt
|
|
|
|
ETCD_KEY_FILE=/etc/ssl/certs/etcd/server.key
|
|
|
|
ETCD_CLIENT_CERT_AUTH=true
|
|
|
|
ETCD_PEER_TRUSTED_CA_FILE=/etc/ssl/certs/etcd/peer-ca.crt
|
|
|
|
ETCD_PEER_CERT_FILE=/etc/ssl/certs/etcd/peer.crt
|
|
|
|
ETCD_PEER_KEY_FILE=/etc/ssl/certs/etcd/peer.key
|
|
|
|
ETCD_PEER_CLIENT_CERT_AUTH=true
|
2018-04-04 09:42:45 +02:00
|
|
|
- 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}'
|
2018-04-06 08:11:34 +02:00
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
2018-04-04 09:42:45 +02:00
|
|
|
- path: /etc/systemd/system/kubelet.service
|
2018-03-25 09:08:03 +02:00
|
|
|
content: |
|
|
|
|
[Unit]
|
|
|
|
Description=Kubelet
|
|
|
|
Requires=cloud-metadata.service
|
|
|
|
After=cloud-metadata.service
|
|
|
|
Wants=rpc-statd.service
|
|
|
|
[Service]
|
2018-04-04 09:42:45 +02:00
|
|
|
WorkingDirectory=/etc/kubernetes
|
2018-03-25 09:08:03 +02:00
|
|
|
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"
|
2018-04-04 09:42:45 +02:00
|
|
|
# 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
|
2018-03-25 09:08:03 +02:00
|
|
|
ExecStart=
|
2018-04-04 09:42:45 +02:00
|
|
|
ExecStart=/usr/local/bin/kubelet \
|
2018-03-25 09:08:03 +02:00
|
|
|
--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/master \
|
|
|
|
--node-labels=node-role.kubernetes.io/controller="true" \
|
|
|
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
|
|
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
|
|
|
--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/systemd/system/bootkube.service
|
|
|
|
content: |
|
|
|
|
[Unit]
|
|
|
|
Description=Bootstrap a Kubernetes cluster
|
2018-04-04 09:42:45 +02:00
|
|
|
ConditionPathExists=!/var/bootkube/init_bootkube.done
|
2018-03-25 09:08:03 +02:00
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
|
|
|
RemainAfterExit=true
|
2018-04-04 09:42:45 +02:00
|
|
|
WorkingDirectory=/var/bootkube
|
|
|
|
ExecStartPre=/bin/mkdir -p /var/bootkube
|
|
|
|
ExecStart=/usr/local/bin/bootkube-start
|
|
|
|
ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done
|
2018-03-25 09:08:03 +02:00
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
2018-04-04 09:42:45 +02:00
|
|
|
- path: /etc/kubernetes/.keep
|
|
|
|
- path: /var/bootkube/.keep
|
|
|
|
- path: /etc/selinux/config
|
|
|
|
owner: root:root
|
|
|
|
permissions: '0644'
|
|
|
|
content: |
|
|
|
|
SELINUX=permissive
|
|
|
|
SELINUXTYPE=targeted
|
|
|
|
- path: /usr/local/bin/bootkube-start
|
|
|
|
permissions: '0755'
|
2018-03-25 09:08:03 +02:00
|
|
|
content: |
|
|
|
|
#!/bin/bash -e
|
|
|
|
# Wrapper for bootkube start
|
2018-04-04 09:42:45 +02:00
|
|
|
[ -n "$(ls /var/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /var/bootkube/assets/manifests-*/* /var/bootkube/assets/manifests && rm -rf /var/bootkube/assets/manifests-*
|
2018-03-25 09:08:03 +02:00
|
|
|
/usr/bin/docker run --rm --name bootkube \
|
2018-04-04 09:42:45 +02:00
|
|
|
--net=host \
|
2018-03-25 09:08:03 +02:00
|
|
|
--volume /etc/kubernetes:/etc/kubernetes:Z \
|
2018-04-04 09:42:45 +02:00
|
|
|
--volume /var/bootkube/assets:/assets:Z \
|
2018-03-25 09:08:03 +02:00
|
|
|
--entrypoint=/bootkube \
|
|
|
|
quay.io/coreos/bootkube:v0.11.0 start --asset-dir=/assets
|
2018-04-04 09:42:45 +02:00
|
|
|
bootcmd:
|
|
|
|
- [setenforce, Permissive]
|
2018-03-25 09:08:03 +02:00
|
|
|
runcmd:
|
|
|
|
- [systemctl, daemon-reload]
|
2018-04-06 08:11:34 +02:00
|
|
|
- "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f"
|
|
|
|
- [systemctl, start, --no-block, etcd.service]
|
2018-03-25 09:08:03 +02:00
|
|
|
- [systemctl, enable, cloud-metadata.service]
|
|
|
|
- [systemctl, enable, kubelet.path]
|
|
|
|
- [systemctl, start, --no-block, kubelet.path]
|
2018-04-04 09:42:45 +02:00
|
|
|
- [systemctl, disable, firewalld, --now]
|
2018-03-25 09:08:03 +02:00
|
|
|
users:
|
|
|
|
- default
|
|
|
|
- name: fedora
|
|
|
|
gecos: Fedora Admin
|
|
|
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
|
|
groups: wheel,adm,systemd-journal,docker
|
|
|
|
ssh-authorized-keys:
|
|
|
|
- "${ssh_authorized_key}"
|