From 48252b6ccd6b44e831d475cbc91592204b86ccec Mon Sep 17 00:00:00 2001 From: Ashley Dumaine Date: Thu, 29 Feb 2024 13:39:53 -0500 Subject: [PATCH] add workaround to get both container logs working and server join working without controlPlaneEndpoint registration support on rke2 --- templates/flavors/rke2/rke2ConfigTemplate.yaml | 4 ++++ templates/flavors/rke2/rke2ControlPlane.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/templates/flavors/rke2/rke2ConfigTemplate.yaml b/templates/flavors/rke2/rke2ConfigTemplate.yaml index 61d2db041..8d2a0feff 100644 --- a/templates/flavors/rke2/rke2ConfigTemplate.yaml +++ b/templates/flavors/rke2/rke2ConfigTemplate.yaml @@ -12,7 +12,11 @@ spec: kubelet: extraArgs: - "provider-id=linode://{{ ds.meta_data.id }}" + # TODO: use MDS to get public and private IP instead because hostname ordering can't always be assumed preRKE2Commands: + - | + mkdir -p /etc/rancher/rke2/config.yaml.d/ + echo "node-ip: $(hostname -I | grep -oE 192\.168\.[0-9]+\.[0-9]+)" >> /etc/rancher/rke2/config.yaml.d/capi-config.yaml - sed -i '/swap/d' /etc/fstab - swapoff -a - hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname diff --git a/templates/flavors/rke2/rke2ControlPlane.yaml b/templates/flavors/rke2/rke2ControlPlane.yaml index f066303fc..a2178ac83 100644 --- a/templates/flavors/rke2/rke2ControlPlane.yaml +++ b/templates/flavors/rke2/rke2ControlPlane.yaml @@ -21,6 +21,7 @@ spec: name: linode-${CLUSTER_NAME}-crs-0 owner: root:root path: /var/lib/rancher/rke2/server/manifests/linode-token-region.yaml + registrationMethod: internal-only-ips serverConfig: cni: cilium cloudProviderName: external @@ -36,6 +37,9 @@ spec: extraArgs: - "provider-id=linode://{{ ds.meta_data.id }}" preRKE2Commands: + - | + mkdir -p /etc/rancher/rke2/config.yaml.d/ + echo "node-ip: $(hostname -I | grep -oE 192\.168\.[0-9]+\.[0-9]+)" >> /etc/rancher/rke2/config.yaml.d/capi-config.yaml - sed -i '/swap/d' /etc/fstab - swapoff -a - hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname