mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-27 21:29:33 +01:00
37981f9fb1
* Require Webhook authorization to the Kubelet * Switch apiserver X509 client cert org to systems:masters to grant the apiserver admin and satisfy the authorization requirement. kubectl commands like logs or exec that have the apiserver make requests of a kubelet continue to work as before * https://kubernetes.io/docs/admin/kubelet-authentication-authorization/ * https://github.com/poseidon/typhoon/issues/215
81 lines
2.8 KiB
Cheetah
81 lines
2.8 KiB
Cheetah
#cloud-config
|
|
write_files:
|
|
- path: /etc/systemd/system/cloud-metadata.service
|
|
content: |
|
|
[Unit]
|
|
Description=Cloud metadata agent
|
|
[Service]
|
|
Type=oneshot
|
|
Environment=OUTPUT=/run/metadata/cloud
|
|
ExecStart=/usr/bin/mkdir -p /run/metadata
|
|
ExecStart=/usr/bin/bash -c 'echo "HOSTNAME_OVERRIDE=$(curl\
|
|
--url http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address\
|
|
--retry 10)" > $${OUTPUT}'
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
- path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
|
|
content: |
|
|
[Unit]
|
|
Requires=cloud-metadata.service
|
|
After=cloud-metadata.service
|
|
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 /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 \
|
|
--authentication-token-webhook \
|
|
--authorization-mode=Webhook \
|
|
--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/node \
|
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins"
|
|
- path: /etc/systemd/system/kubelet.path
|
|
content: |
|
|
[Unit]
|
|
Description=Watch for kubeconfig
|
|
[Path]
|
|
PathExists=/etc/kubernetes/kubeconfig
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
- path: /etc/selinux/config
|
|
owner: root:root
|
|
permissions: '0644'
|
|
content: |
|
|
SELINUX=permissive
|
|
SELINUXTYPE=targeted
|
|
bootcmd:
|
|
- [setenforce, Permissive]
|
|
- [systemctl, disable, firewalld, --now]
|
|
# https://github.com/kubernetes/kubernetes/issues/60869
|
|
- [modprobe, ip_vs]
|
|
runcmd:
|
|
- [systemctl, daemon-reload]
|
|
- [systemctl, enable, cloud-metadata.service]
|
|
- "atomic install --system --name=kubelet quay.io/poseidon/kubelet:v1.10.2"
|
|
- [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}"
|