Skip to content

Commit 5975c88

Browse files
cannot use kubelet-arg to set node-ip for k3s (#369)
1 parent dd6f282 commit 5975c88

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

templates/flavors/k3s/dual-stack/kustomization.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ patches:
8989
value:
9090
- |
9191
mkdir -p /etc/rancher/k3s/config.yaml.d/
92-
echo -n "kubelet-arg: \"--node-ip=" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
93-
echo -n "$(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
94-
echo ",$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')\"" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
92+
echo "node-ip: $(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168'),$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
9593
- sed -i '/swap/d' /etc/fstab
9694
- swapoff -a
9795
- hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname
@@ -105,9 +103,7 @@ patches:
105103
value:
106104
- |
107105
mkdir -p /etc/rancher/k3s/config.yaml.d/
108-
echo -n "kubelet-arg: \"--node-ip=" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
109-
echo -n "$(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
110-
echo ",$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')\"" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
106+
echo "node-ip: $(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168'),$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
111107
- sed -i '/swap/d' /etc/fstab
112108
- swapoff -a
113109
- hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname

templates/flavors/k3s/full-vpcless/kustomization.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ patches:
145145
value:
146146
- |
147147
mkdir -p /etc/rancher/k3s/config.yaml.d/
148-
echo -n "kubelet-arg: \"--node-ip=" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
149-
echo -n "$(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
150-
echo ",$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')\"" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
148+
echo "node-ip: $(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168'),$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
151149
- sed -i '/swap/d' /etc/fstab
152150
- swapoff -a
153151
- hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname
@@ -161,9 +159,7 @@ patches:
161159
value:
162160
- |
163161
mkdir -p /etc/rancher/k3s/config.yaml.d/
164-
echo -n "kubelet-arg: \"--node-ip=" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
165-
echo -n "$(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
166-
echo ",$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')\"" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
162+
echo "node-ip: $(ip a s eth0 |grep -E 'inet ' |cut -d' ' -f6|cut -d/ -f1 | grep -E '192.168'),$(ip a s eth0 |grep -E 'inet6 ' |cut -d' ' -f6|cut -d/ -f1 | grep -vE 'fe80')" >> /etc/rancher/k3s/config.yaml.d/capi-config.yaml
167163
- sed -i '/swap/d' /etc/fstab
168164
- swapoff -a
169165
- hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname

0 commit comments

Comments
 (0)