|
| 1 | +--- |
| 2 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 3 | +kind: MachineDeployment |
| 4 | +metadata: |
| 5 | + name: ${CLUSTER_NAME}-md-0 |
| 6 | +spec: |
| 7 | + clusterName: ${CLUSTER_NAME} |
| 8 | + replicas: ${WORKER_MACHINE_COUNT} |
| 9 | + selector: |
| 10 | + matchLabels: null |
| 11 | + template: |
| 12 | + spec: |
| 13 | + bootstrap: |
| 14 | + configRef: |
| 15 | + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 |
| 16 | + kind: KubeadmConfigTemplate |
| 17 | + name: ${CLUSTER_NAME}-md-0 |
| 18 | + clusterName: ${CLUSTER_NAME} |
| 19 | + infrastructureRef: |
| 20 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 21 | + kind: AzureMachineTemplate |
| 22 | + name: ${CLUSTER_NAME}-md-0 |
| 23 | + version: ${KUBERNETES_VERSION} |
| 24 | +--- |
| 25 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 26 | +kind: AzureMachineTemplate |
| 27 | +metadata: |
| 28 | + name: ${CLUSTER_NAME}-md-0 |
| 29 | +spec: |
| 30 | + template: |
| 31 | + spec: |
| 32 | + image: |
| 33 | + computeGallery: |
| 34 | + gallery: flatcar-23485951-527a-48d6-9d11-6931ff0afc2e |
| 35 | + name: flatcar-stable-amd64 |
| 36 | + version: ${FLATCAR_VERSION} |
| 37 | + osDisk: |
| 38 | + diskSizeGB: 128 |
| 39 | + osType: Linux |
| 40 | + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} |
| 41 | + vmSize: ${AZURE_NODE_MACHINE_TYPE} |
| 42 | +--- |
| 43 | +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 |
| 44 | +kind: KubeadmConfigTemplate |
| 45 | +metadata: |
| 46 | + name: ${CLUSTER_NAME}-md-0 |
| 47 | +spec: |
| 48 | + template: |
| 49 | + spec: |
| 50 | + files: |
| 51 | + - contentFrom: |
| 52 | + secret: |
| 53 | + key: worker-node-azure.json |
| 54 | + name: ${CLUSTER_NAME}-md-0-azure-json |
| 55 | + owner: root:root |
| 56 | + path: /etc/kubernetes/azure.json |
| 57 | + permissions: "0644" |
| 58 | + format: ignition |
| 59 | + ignition: |
| 60 | + containerLinuxConfig: |
| 61 | + additionalConfig: | |
| 62 | + storage: |
| 63 | + links: |
| 64 | + - path: /etc/extensions/kubernetes.raw |
| 65 | + hard: false |
| 66 | + target: /opt/extensions/kubernetes/kubernetes-${KUBERNETES_VERSION}-x86-64.raw |
| 67 | + files: |
| 68 | + - path: /etc/sysupdate.kubernetes.d/kubernetes-${KUBERNETES_VERSION%.*}.conf |
| 69 | + mode: 0644 |
| 70 | + contents: |
| 71 | + remote: |
| 72 | + url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${KUBERNETES_VERSION%.*}.conf |
| 73 | + - path: /etc/sysupdate.d/noop.conf |
| 74 | + mode: 0644 |
| 75 | + contents: |
| 76 | + remote: |
| 77 | + url: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf |
| 78 | + - path: /opt/extensions/kubernetes/kubernetes-${KUBERNETES_VERSION}-x86-64.raw |
| 79 | + contents: |
| 80 | + remote: |
| 81 | + url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${KUBERNETES_VERSION}-x86-64.raw |
| 82 | + systemd: |
| 83 | + units: |
| 84 | + - name: systemd-sysupdate.service |
| 85 | + dropins: |
| 86 | + - name: kubernetes.conf |
| 87 | + contents: | |
| 88 | + [Service] |
| 89 | + ExecStartPre=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes" |
| 90 | + ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C kubernetes update |
| 91 | + ExecStartPost=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes-new" |
| 92 | + ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/kubernetes /tmp/kubernetes-new; then touch /run/reboot-required; fi" |
| 93 | + - name: update-engine.service |
| 94 | + # Set this to 'false' if you want to enable Flatcar auto-update |
| 95 | + mask: ${FLATCAR_DISABLE_AUTO_UPDATE:=true} |
| 96 | + - name: locksmithd.service |
| 97 | + # NOTE: To coordinate the node reboot in this context, we recommend to use Kured. |
| 98 | + mask: true |
| 99 | + - name: systemd-sysupdate.timer |
| 100 | + # Set this to 'true' if you want to enable the Kubernetes auto-update. |
| 101 | + # NOTE: Only patches version will be pulled. |
| 102 | + enabled: false |
| 103 | + - name: kubeadm.service |
| 104 | + dropins: |
| 105 | + - name: 10-flatcar.conf |
| 106 | + contents: | |
| 107 | + [Unit] |
| 108 | + After=oem-cloudinit.service |
| 109 | + # kubeadm must run after containerd - see https://github.com/kubernetes-sigs/image-builder/issues/939. |
| 110 | + After=containerd.service |
| 111 | + joinConfiguration: |
| 112 | + nodeRegistration: |
| 113 | + kubeletExtraArgs: |
| 114 | + cloud-provider: external |
| 115 | + name: '@@HOSTNAME@@' |
| 116 | + postKubeadmCommands: [] |
| 117 | + preKubeadmCommands: |
| 118 | + - sed -i "s/@@HOSTNAME@@/$(curl -s -H Metadata:true --noproxy '*' 'http://169.254.169.254/metadata/instance?api-version=2020-09-01' | jq -r .compute.name)/g" /etc/kubeadm.yml |
0 commit comments