feat(os): adding flatcar butane config for k8s

This commit is contained in:
Philippe Caseiro 2022-11-23 16:41:31 +01:00
parent ab7c3a7184
commit fc2c9a2a5f
1 changed files with 115 additions and 0 deletions

115
butane/k8s.yaml Normal file
View File

@ -0,0 +1,115 @@
variant: flatcar
version: 1.0.0
passwd:
users:
- name: cadoles
password_hash: "$y$j9T$7dNoyJBSiQ5dJ6.kLs17I0$G9VVQkBUddW2E6TVQchecSE94jNxLz4F3wguz5QkvD8"
groups:
- wheel
- sudo
ssh_authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDDph3zh6ojSvH44k13z9B6xj+Hargo3uzkxnYv5s5NI4yagNuBXEc3aS++KdocND+FtVfLK+iVE8qHo2bvmpMmVkqU6WU2apN7DfIP0QGLlSGeo+UOZ9hGeEDlgVO4AOnZKZ5kPGBEPZ84JXuE9CmhKfwEVCK8w3B8XQttA8alFl4A4/4F14x2w4njsSLY1H3b0qah7hgYKU5zHIGLg8Lxx+1BxGIF0l5n5m5rqAskRNaF+aYbs0CcWHv49bPK0sJJ0qPV2r2sq8BlzuZFHExnZRIxpsIXdce4Bm4rdlGi7tBmmurLk4OOtDkwvhD0LMaNJf10k6QLSmRUTVzgsYz/dmGxopbMtwwIXkwi014uSZgi8wAuznXx5I4j2TUGPZHOVf+1iw/yaxWlgTVOSoX7ZxyhDgW5cCgZZGNzU5UWe0vUuVTB+hfSMj50/Q6+Vi92/mDMbPhm4nBoVzD5DT15mB+yGyN45Ej61m0JzVUyZexfvVaffEug1/u5dnwilP0WGKr4i2OXxOXtvSdAs5rlZjvppZk6IxRCwXIcPwEFL97ZrQZAxlVS5Nh+ZnlSwTe3zfQhzHj1ao0AdCAHFPUEdoUPJhSb0OjyCvZ9XZ1KCkXhuhuN/3IUhuoWl4soNCeC3KmU/USx1wda438Exj0hM1mTyBZScDPGyD9nw78DGw== Philippe Caseiro"
systemd:
units:
- name: install-cni.service
enabled: true
contents: |
[Unit]
Description=Install CNI plugins K8S
Wants = network-online.target
After = network.target network-online.target
ConditionPathExists=!/opt/cni/bin/firewall
[Service]
Type=forking
TimeoutStartSec=180
RemainAfterExit=yes
KillMode=process
Environment="CNI_VERSION=v0.8.2"
Environment="ARCH=amd64"
Environment="URL=https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz"
ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStart=/bin/sh -c "/usr/bin/curl -L ${URL} | /usr/bin/tar -C /opt/cni/bin -xz"
[Install]
WantedBy=multi-user.target
- name: install-crictl.service
enabled: true
contents: |
[Unit]
Description=Install crictl
Wants = network-online.target
After = network.target network-online.target
ConditionPathExists=!/opt/bin/crictl
[Service]
Type=forking
TimeoutStartSec=180
RemainAfterExit=yes
KillMode=process
Environment="DOWNLOAD_DIR=/opt/bin"
Environment="CRICTL_VERSION=v1.22.0"
Environment="ARCH=amd64"
Environment="URL=https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz"
ExecStartPre=/bin/mkdir -p ${DOWNLOAD_DIR}
ExecStart=/bin/sh -c "/usr/bin/curl -L ${URL} | /usr/bin/tar -C $DOWNLOAD_DIR -xz"
[Install]
WantedBy=multi-user.target
- name: install-kubernetes.service
enabled: true
contents: |
[Unit]
Description=Install K8S
Wants = network-online.target
After = network.target network-online.target
ConditionPathExists=!/opt/bin/kubelet
[Service]
WorkingDirectory=/opt/bin
Type=forking
TimeoutStartSec=180
RemainAfterExit=yes
KillMode=process
Environment="RELEASE_VERSION=0.6.0"
Environment="RELEASE=v1.25.4"
Environment="ARCH=amd64"
Environment="DOWNLOAD_DIR=/opt/bin"
Environment="URL=https://storage.googleapis.com/kubernetes-release/release/${RELEASE}/bin/linux/${ARCH}"
ExecStartPre=/bin/mkdir -p ${DOWNLOAD_DIR}
ExecStart=/bin/sh -c "/usr/bin/curl -L --remote-name-all ${URL}/{kubeadm,kubelet,kubectl}"
ExecStartPost=/bin/chmod +x ${DOWNLOAD_DIR}/{kubeadm,kubelet,kubectl}
[Install]
WantedBy=multi-user.target
- name: kubelet.service
enabled: true
contents: |
[Unit]
Description=The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/home/
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/opt/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
dropins:
- name: 10-kubeadm.conf
contents: |
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: node1
- path: /etc/sysctl.d/k8s.conf
mode: 0600
contents:
inline: |
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1