2 apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4
3 kind: KubeadmConfigTemplate
5 name: {{ .Values.clusterName }}-workers
12 node-labels: metal3.io/uuid={{ "{{" }} ds.meta_data.uuid {{ "}}" }}
13 cpu-manager-policy: static
14 topology-manager-policy: best-effort
15 kube-reserved: cpu=100m,memory=256Mi
16 name: '{{ "{{" }} ds.meta_data.name {{ "}}" }}'
18 {{- if .Values.networks }}
19 # Without touching up /etc/hosts, kubeadm may pick the wrong
20 # (i.e. provisioning network) address for the node IP
21 - sed -i "1i $(ip -4 addr show dev {{ .Values.networks.baremetal.interface }} | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1) $(hostname)" /etc/hosts
23 - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
24 - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
25 - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
26 - add-apt-repository "deb https://apt.kubernetes.io/ kubernetes-xenial main"
28 - apt-get install -y ca-certificates
29 - /usr/local/bin/install-container-runtime.sh
30 - apt-get install -y kubelet={{ .Values.kubeVersion }} kubeadm={{ .Values.kubeVersion }} kubectl={{ .Values.kubeVersion }}
31 - systemctl enable --now kubelet
33 - /usr/local/bin/harden_os.sh
34 # This must be done after kubeadm as the cabpk provider relies
35 # on files in /var/run, which won't persist after a reboot
36 - /usr/local/bin/set_kernel_cmdline.sh
38 {{ include "cluster.containerRuntime" .Values | indent 6 }}
39 - path: /etc/systemd/system/containerd.service.d/override.conf
41 {{ $.Files.Get "resources/override.conf" | indent 10 }}
42 - path: /usr/local/bin/harden_os.sh
45 {{ $.Files.Get "resources/harden_os.sh" | indent 10 }}
46 - path: /usr/local/bin/set_kernel_cmdline.sh
49 {{ $.Files.Get "resources/set_kernel_cmdline.sh" | indent 10 }}
50 {{- if .Values.userData }}
52 - name: {{ .Values.userData.name }}
54 lockPassword: False # Necessary to allow password login
55 passwd: {{ .Values.userData.hashedPassword }}
57 - {{ .Values.userData.sshAuthorizedKey }}
58 sudo: "ALL=(ALL) NOPASSWD:ALL"
59 groups: sudo # Necessary to allow SSH logins (see /etc/ssh/sshd_config)
62 - {{ .Values.userData.sshAuthorizedKey }}