mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-27 07:39:33 +01:00
108 lines
4.3 KiB
Cheetah
108 lines
4.3 KiB
Cheetah
#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_LISTEN_METRICS_URLS=http://0.0.0.0:2381
|
|
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
|
|
- path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
|
|
content: |
|
|
[Unit]
|
|
Wants=rpc-statd.service
|
|
[Service]
|
|
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"
|
|
Restart=always
|
|
RestartSec=10
|
|
- path: /etc/kubernetes/kubelet.conf
|
|
content: |
|
|
ARGS="--allow-privileged \
|
|
--anonymous-auth=false \
|
|
--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 \
|
|
--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"
|
|
- path: /etc/kubernetes/kubeconfig
|
|
permissions: '0644'
|
|
content: |
|
|
${kubeconfig}
|
|
- path: /etc/systemd/system/bootkube.service
|
|
content: |
|
|
[Unit]
|
|
Description=Bootstrap a Kubernetes cluster
|
|
ConditionPathExists=!/var/bootkube/init_bootkube.done
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=true
|
|
WorkingDirectory=/var/bootkube
|
|
ExecStartPre=/bin/mkdir -p /var/bootkube
|
|
ExecStart=/usr/local/bin/bootkube-start
|
|
ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
- path: /var/bootkube/.keep
|
|
- path: /usr/local/bin/bootkube-start
|
|
permissions: '0755'
|
|
content: |
|
|
#!/bin/bash -e
|
|
# Wrapper for bootkube start
|
|
[ -n "$(ls /var/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /var/bootkube/assets/manifests-*/* /var/bootkube/assets/manifests && rm -rf /var/bootkube/assets/manifests-*
|
|
/usr/bin/docker run --rm --name bootkube \
|
|
--net=host \
|
|
--volume /etc/kubernetes:/etc/kubernetes:Z \
|
|
--volume /var/bootkube/assets:/assets:Z \
|
|
--entrypoint=/bootkube \
|
|
quay.io/coreos/bootkube:v0.12.0 start --asset-dir=/assets
|
|
- path: /etc/selinux/config
|
|
owner: root:root
|
|
permissions: '0644'
|
|
content: |
|
|
SELINUX=permissive
|
|
SELINUXTYPE=targeted
|
|
bootcmd:
|
|
- [setenforce, Permissive]
|
|
runcmd:
|
|
- [systemctl, daemon-reload]
|
|
- "atomic install --system --name=etcd quay.io/dghubble/etcd:0265e6680d2533f3fbf4512af868d29ff07451ca"
|
|
- [systemctl, start, --no-block, etcd.service]
|
|
- "atomic install --system --name=kubelet quay.io/dghubble/kubelet:8767d4433f7c5a38c55edf6e682efb53fcd06f61"
|
|
- [systemctl, start, --no-block, kubelet.service]
|
|
- [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}"
|