Skip to content

Commit 6f55933

Browse files
committed
feat: baseline template for kubeadm
1 parent fa5f2e8 commit 6f55933

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"name": "baseline-kubeadm",
3+
"version": "v2.0.1",
4+
"kubernetesVersion": "v1.30.10",
5+
"description": "Baseline Cluster Template with Kubeadm Control Plane",
6+
"controlplaneprovidertype": "kubeadm",
7+
"infraprovidertype": "intel",
8+
"clusterconfiguration": {
9+
"kind": "KubeadmControlPlaneTemplate",
10+
"apiVersion": "controlplane.cluster.x-k8s.io/v1beta1",
11+
"metadata": {
12+
"labels": {
13+
"cpumanager": "true"
14+
}
15+
},
16+
"spec": {
17+
"template": {
18+
"spec": {
19+
"files": [
20+
{
21+
"path": "/usr/local/bin/append-containerd-config.sh",
22+
"content": "cat <<EOF >> /etc/containerd/config.toml\n\n[plugins.\\\"io.containerd.internal.v1.opt\\\"]\n path = \\\"/var/lib/rancher/rke2/agent/containerd\\\"\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\"]\n stream_server_address = \\\"127.0.0.1\\\"\n stream_server_port = \\\"10010\\\"\n enable_selinux = false\n enable_unprivileged_ports = true\n enable_unprivileged_icmp = true\n sandbox_image = \\\"index.docker.io/rancher/mirrored-pause:3.6\\\"\n disable_apparmor = true\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\".containerd]\n snapshotter = \\\"overlayfs\\\"\n disable_snapshot_annotations = true\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\".containerd.runtimes.runc]\n runtime_type = \\\"io.containerd.runc.v2\\\"\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\".containerd.runtimes.runc.options]\n SystemdCgroup = true\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\".registry]\n config_path = \\\"/var/lib/rancher/rke2/agent/etc/containerd/certs.d\\\"\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\".containerd.runtimes.kata-qemu]\n runtime_type = \\\"io.containerd.kata-qemu.v2\\\"\n runtime_path = \\\"/opt/kata/bin/containerd-shim-kata-v2\\\"\n privileged_without_host_devices = true\n pod_annotations = [\\\"io.katacontainers.*\\\"]\n\n[plugins.\\\"io.containerd.grpc.v1.cri\\\".containerd.runtimes.kata-qemu.options]\n ConfigPath = \\\"/opt/kata/share/defaults/kata-containers/configuration-qemu.toml\\\"\n\nEOF"
23+
}
24+
],
25+
"clusterConfiguration": {
26+
"apiServer": {
27+
"extraArgs": {
28+
"feature-gates": "PortForwardWebsockets=true",
29+
"tls-cipher-suites":"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
30+
}
31+
},
32+
"controllerManager":{
33+
"extraArgs": {}
34+
},
35+
"etcd":{
36+
"local": {
37+
"extraArgs": {
38+
"cipher-suites": "[TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384]"
39+
}
40+
}
41+
},
42+
"scheduler":{
43+
"extraArgs": {}
44+
}
45+
},
46+
"joinConfiguration": {
47+
"nodeRegistration": {
48+
"kubeletExtraArgs": {
49+
"topology-manager-policy": "best-effort",
50+
"cpu-manager-policy": "static",
51+
"reserved-cpus": "1",
52+
"max-pods": "250",
53+
"tls-cipher-suites": "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
54+
}
55+
}
56+
},
57+
"preKubeadmCommands": [
58+
"/usr/local/bin/append-containerd-config.sh",
59+
"mkdir -p /etc/systemd/system/rke2-server.service.d",
60+
"echo '[Service]\nEnvironmentFile=/etc/environment' > /etc/systemd/system/rke2-server.service.d/override.conf"
61+
],
62+
63+
"privateRegistriesConfig": {
64+
"mirrors": {
65+
"rs-proxy.rs-proxy.svc.cluster.local:8443": {
66+
"endpoint": [
67+
"https://localhost.internal:9443"
68+
]
69+
}
70+
}
71+
},
72+
"nodeDrainTimeout": "2m",
73+
"rolloutStrategy": {
74+
"type": "RollingUpdate",
75+
"rollingUpdate": {
76+
"maxSurge": 1
77+
}
78+
}
79+
}
80+
}
81+
}
82+
},
83+
"clusterNetwork": {
84+
"pods": {
85+
"cidrBlocks": [
86+
"10.42.0.0/16"
87+
]
88+
},
89+
"services": {
90+
"cidrBlocks": [
91+
"10.43.0.0/16"
92+
]
93+
}
94+
},
95+
"cluster-labels": {
96+
"default-extension": "baseline"
97+
}
98+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This is the configuration file added to the default templates in the spec.files.content field.
2+
# To update the cluster template, make sure you have the following tools installed in your environment:
3+
# - grep (https://www.gnu.org/software/grep/)
4+
# - jo (https://github.com/jpmens/jo)
5+
# - jq (https://jqlang.org/)
6+
# - sed (https://www.gnu.org/software/sed/)
7+
# The string in the template can be created from this file using the following command:
8+
# jo content="$(grep -v '^#' kubeadm.config.toml)"|sed 's/\\"/\\\\\\\"/g'|jq .content
9+
# The result can then be pasted into the template files as the "content".
10+
# The "sed" command performs triple backslashing of quotes, which seems to be required.
11+
cat <<EOF >> /etc/containerd/config.toml
12+
13+
[plugins."io.containerd.internal.v1.opt"]
14+
path = "/var/lib/rancher/rke2/agent/containerd"
15+
16+
[plugins."io.containerd.grpc.v1.cri"]
17+
stream_server_address = "127.0.0.1"
18+
stream_server_port = "10010"
19+
enable_selinux = false
20+
enable_unprivileged_ports = true
21+
enable_unprivileged_icmp = true
22+
sandbox_image = "index.docker.io/rancher/mirrored-pause:3.6"
23+
disable_apparmor = true
24+
25+
[plugins."io.containerd.grpc.v1.cri".containerd]
26+
snapshotter = "overlayfs"
27+
disable_snapshot_annotations = true
28+
29+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
30+
runtime_type = "io.containerd.runc.v2"
31+
32+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
33+
SystemdCgroup = true
34+
35+
[plugins."io.containerd.grpc.v1.cri".registry]
36+
config_path = "/var/lib/rancher/rke2/agent/etc/containerd/certs.d"
37+
38+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.kata-qemu]
39+
runtime_type = "io.containerd.kata-qemu.v2"
40+
runtime_path = "/opt/kata/bin/containerd-shim-kata-v2"
41+
privileged_without_host_devices = true
42+
pod_annotations = ["io.katacontainers.*"]
43+
44+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.kata-qemu.options]
45+
ConfigPath = "/opt/kata/share/defaults/kata-containers/configuration-qemu.toml"
46+
47+
EOF

0 commit comments

Comments
 (0)