Skip to content

Commit cda7cf1

Browse files
committed
feat: optimize server/agent workload and shorten kube-vip lease
1 parent 2a7f723 commit cda7cf1

9 files changed

+13
-46
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ yourself `/etc/rancher/rke2/rke2.yaml` on server nodes.
7373

7474
```
7575
# remove server url from rke2 config
76-
vim /etc/rancher/rke2/config.yaml
76+
sudo vim /etc/rancher/rke2/config.yaml
7777
# ssh into one of the server nodes (see terraform output -json)
7878
# restore s3 snapshot (see restore_cmd output of the terraform module):
7979
sudo systemctl stop rke2-server

agent.log.zip

2.14 MB
Binary file not shown.

manifests/velero.yaml.tpl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ spec:
2626
volumeMounts:
2727
- mountPath: /target
2828
name: plugins
29-
nodeSelector:
30-
node-role.kubernetes.io/master: "true"
3129
tolerations:
3230
- effect: NoExecute
3331
key: CriticalAddonsOnly
@@ -38,7 +36,7 @@ spec:
3836
memory: 128Mi
3937
limits:
4038
cpu: null
41-
memory: null
39+
memory: 256Mi
4240
kubectl:
4341
image:
4442
repository: docker.io/bitnami/kubectl
@@ -53,7 +51,7 @@ spec:
5351
bucket: ${bucket_velero}
5452
config:
5553
cloud: self
56-
region: ${region}
54+
region: ${region}
5755
volumeSnapshotLocation:
5856
- name: default
5957
provider: csi
@@ -64,7 +62,6 @@ spec:
6462
OS_APPLICATION_CREDENTIAL_SECRET: ${app_secret}
6563
# for community.openstack.org/openstack (env vars do not work and take precedence over clouds.yaml unless cloud set)
6664
OS_CLOUD: self
67-
6865
credentials:
6966
# for community.openstack.org/openstack
7067
secretContents:
@@ -89,10 +86,8 @@ spec:
8986
mountPath: /etc/openstack/clouds.yaml
9087
readOnly: true
9188
subPath: clouds.yaml
92-
9389
backupsEnabled: true
9490
snapshotsEnabled: true
95-
9691
deployNodeAgent: true
9792
nodeAgent:
9893
podVolumePath: /var/lib/kubelet/pods

node/cloud-init.yaml.tpl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ write_files:
8787
curl -sfL https://get.rke2.io | sh -
8888
fi
8989
%{ if is_server ~}
90-
%{~ if is_first ~}
9190
%{~ for k, v in manifests_files ~}
9291
- path: /opt/rke2/manifests/${k}
9392
permissions: "0600"
@@ -129,7 +128,6 @@ write_files:
129128
/usr/local/bin/customize-chart.sh "$CHARTS_DIR/$patch_name" "$patch"
130129
fi
131130
done
132-
%{~ endif ~}
133131
- path: /etc/modules-load.d/ipvs.conf
134132
permissions: "0644"
135133
owner: root:root
@@ -175,11 +173,11 @@ write_files:
175173
- name: vip_leasename
176174
value: plndr-cp-lock
177175
- name: vip_leaseduration
178-
value: "15"
176+
value: "5"
179177
- name: vip_renewdeadline
180-
value: "10"
178+
value: "3"
181179
- name: vip_retryperiod
182-
value: "2"
180+
value: "1"
183181
- name: enable_node_labeling
184182
value: "true"
185183
- name: lb_enable
@@ -292,17 +290,13 @@ runcmd:
292290
- until [ -d /var/lib/rancher/rke2/agent/pod-manifests/ ]; do echo "Waiting for $(hostname) static pods"; sleep 1; done
293291
- mv -v /opt/rke2/kube-vip.yaml /var/lib/rancher/rke2/agent/pod-manifests/kube-vip.yaml
294292
- ls /var/lib/rancher/rke2/agent/pod-manifests
295-
%{~ if is_first ~}
296293
- wget https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/bin/yq
297294
- until [ -d /var/lib/rancher/rke2/data/v*/charts ]; do echo "Waiting for $(hostname) charts data"; sleep 1; done
298295
- /usr/local/bin/customize-charts.sh $(realpath /var/lib/rancher/rke2/data/v*/charts)
299296
- until [ -d /var/lib/rancher/rke2/server/manifests ]; do echo "Waiting for $(hostname) manifests"; sleep 1; done
300297
- /usr/local/bin/customize-charts.sh /var/lib/rancher/rke2/server/manifests
301298
- mv -v /opt/rke2/manifests/*.yaml /var/lib/rancher/rke2/server/manifests
302299
- ls /var/lib/rancher/rke2/server/manifests
303-
%{~ else ~}
304-
- for i in $(find /var/lib/rancher/rke2/server/manifests -type f); do cp -v $i $i.skip; done
305-
%{~ endif ~}
306300
- until systemctl is-active -q rke2-server.service; do echo "Waiting for $(hostname) rke2 to start"; sleep 3; journalctl -u rke2-server.service --since "3 second ago"; done
307301
%{~ else ~}
308302
- systemctl enable rke2-agent.service

node/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ resource "openstack_compute_instance_v2" "instance" {
3939
key_pair = var.keypair_name
4040
config_drive = true
4141

42-
connection {
43-
user = var.system_user
44-
}
45-
4642
network {
4743
port = openstack_networking_port_v2.port[count.index].id
4844
}

patches/rke2-coredns.yaml.tpl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
2-
%{ if operator_replica > 1 }
3-
nodeSelector:
4-
node-role.kubernetes.io/master: "true"
51
resources:
62
requests:
73
cpu: "100m"
@@ -10,5 +6,10 @@ resources:
106
cpu: "100m" # because of autoscaler
117
memory: "128Mi"
128
autoscaler:
13-
enabled: false
14-
%{ endif }
9+
min: ${operator_replica}
10+
resources:
11+
requests:
12+
cpu: "20m"
13+
memory: "10Mi"
14+
limits:
15+
memory: "10Mi"
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +0,0 @@
1-
2-
nodeSelector:
3-
node-role.kubernetes.io/master: "true"
4-
tolerations:
5-
- effect: NoExecute
6-
key: CriticalAddonsOnly
7-
operator: "Exists"
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11

2-
nodeSelector:
3-
node-role.kubernetes.io/master: "true"
4-
tolerations:
5-
- effect: NoExecute
6-
key: CriticalAddonsOnly
7-
operator: "Exists"
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11

2-
nodeSelector:
3-
node-role.kubernetes.io/master: "true"
4-
tolerations:
5-
- effect: NoExecute
6-
key: CriticalAddonsOnly
7-
operator: "Exists"

0 commit comments

Comments
 (0)