feat: add kubernetes v1.31.2 (#2578)

Signed-off-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
liujian 2025-05-20 10:37:07 +08:00 committed by GitHub
parent 80c9a735ab
commit 6aec54a82f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 118 additions and 40 deletions

View File

@ -6,7 +6,11 @@ cri:
# the endpoint of containerd
cri_socket: |
{{- if .cri.container_manager | eq "containerd" }}
unix:///var/run/containerd.sock
unix:///var/run/containerd/containerd.sock
{{- else if and (.cri.container_manager | eq "docker") (.kube_version | semverCompare ">=v1.24.0") }}
unix:///var/run/cri-dockerd.sock
{{- else if and (.cri.container_manager | eq "docker") (.kube_version | semverCompare "<v1.24.0") }}
unix:///var/run/docker.sock
{{- end }}
containerd:
data_root: /var/lib/containerd

View File

@ -26,7 +26,7 @@
{{ .tmp_dir }}/containerd-{{ .containerd_version | default "" | trimPrefix "v" }}-linux-{{ .binary_type.stdout }}.tar.gz
- name: Unpackage containerd binary
command: |
tar -xvf {{ .tmp_dir }}/containerd-{{ .containerd_version | default "" | trimPrefix "v" }}-linux-{{ .binary_type.stdout }}.tar.gz -C /usr/local/bin/
tar -xvf {{ .tmp_dir }}/containerd-{{ .containerd_version | default "" | trimPrefix "v" }}-linux-{{ .binary_type.stdout }}.tar.gz --strip-components=1 -C /usr/local/bin/
- name: Generate containerd config file
template:
src: containerd.config

View File

@ -10,16 +10,12 @@
- name: Sync cri-dockerd Binary to remote
copy:
src: |
{{ .binary_dir }}/cri-dockerd/{{ .cridockerd_version }}/{{ .binary_type.stdout }}/cri-dockerd-{{ .cridockerd_version }}-linux-{{ .binary_type.stdout }}.tar.gz
{{ .binary_dir }}/cri-dockerd/{{ .cridockerd_version }}/{{ .binary_type.stdout }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}.{{ .binary_type.stdout }}.tgz
dest: |
{{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version }}-linux-{{ .binary_type.stdout }}.tar.gz
- name: Generate cri-dockerd config file
template:
src: cri-dockerd.config
dest: /etc/cri-dockerd.yaml
{{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}.{{ .binary_type.stdout }}.tgz
- name: Unpackage cri-dockerd binary
command: |
tar -xvf {{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version }}-linux-{{ .binary_type.stdout }}.tar.gz -C /usr/local/bin/
tar -xvf {{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}.{{ .binary_type.stdout }}.tgz --strip-components=1 -C /usr/local/bin/
- name: Generate cri-dockerd Service file
template:
src: cri-dockerd.service

View File

@ -1,6 +1,6 @@
version = 2
root = {{ .cri.containerd.data_root | default "/var/lib/containerd" }}
root = "{{ .cri.containerd.data_root | default "/var/lib/containerd" }}"
state = "/run/containerd"
[grpc]
@ -40,7 +40,7 @@ state = "/run/containerd"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = {{ if .cri.cgroup_driver | eq "systemd") }}true{{ else }}false{{ end }}
SystemdCgroup = {{ if .cri.cgroup_driver | eq "systemd" }}true{{ else }}false{{ end }}
[plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "/opt/cni/bin"
conf_dir = "/etc/cni/net.d"

View File

@ -10,36 +10,49 @@ spec:
kube_version: v1.23.15
# helm binary
helm_version: v3.14.2
# cni_plugins binary
# cni_plugins_version: v1.2.0
# calicoctl binary
calico_version: v3.28.2
# etcd binary
etcd_version: v3.5.6
# ========== image registry ==========
# keepalived image tag. Used for load balancing when there are multiple image registry nodes.
# keepalived_version: stable
# ========== image registry: harbor ==========
# harbor image tag
# harbor_version: v2.10.1
# docker-compose binary
# dockercompose_version: v2.24.6
# ========== image registry: registry ==========
# registry image tag
# registry_version: 2.8.3
# keepalived image tag
# keepalived_version: stable
# ========== cri ==========
# crictl binary
crictl_version: v1.23.0
# ========== cri: docker ==========
# docker binary
docker_version: 24.0.6
# cilium helm
# cilium_version: 1.15.4
# kubeovn helm
# kubeovn_version: 0.1.0
# hybridnet helm
# hybridnet_version: 0.6.8
# cridockerd. Required when kube_version is greater than 1.24
# cridockerd_version: v0.3.10
# ========== cri: containerd ==========
# containerd binary
# containerd_version: v1.7.0
# containerd_version: v1.7.0
# runc binary
# runc_version: v1.1.11
# cridockerd
# cridockerd_version: v0.3.10
# runc_version: v1.1.11
# ========== cni ==========
# cni_plugins binary
# cni_plugins_version: v1.2.0
# ========== cni: calico ==========
# calicoctl binary
calico_version: v3.28.2
# ========== cni: cilium ==========
# cilium helm
# cilium_version: 1.15.4
# ========== cni: kubeovn ==========
# kubeovn helm
# kubeovn_version: 0.1.0
# ========== cni: hybridnet ==========
# hybridnet helm
# hybridnet_version: 0.6.8
# ========== storageclass ==========
# ========== storageclass: nfs ==========
# nfs provisioner helm version
# nfs_provisioner_version: 4.0.18
kubernetes:

View File

@ -0,0 +1,65 @@
apiVersion: kubekey.kubesphere.io/v1
kind: Config
spec:
# zone for kk. how to download files
# kkzone: cn
# work_dir is the directory where the artifact is extracted.
# work_dir: /var/lib/kubekey/
# the version of kubernetes to be installed.
# should be greater than or equal to kube_version_min_required.
kube_version: v1.31.2
# helm binary
helm_version: v3.16.4
# etcd binary
etcd_version: v3.5.16
# ========== image registry ==========
# keepalived image tag. Used for load balancing when there are multiple image registry nodes.
# keepalived_version: stable
# ========== image registry: harbor ==========
# harbor image tag
# harbor_version: v2.10.1
# docker-compose binary
# dockercompose_version: v2.24.6
# ========== image registry: registry ==========
# registry image tag
# registry_version: 2.8.3
# ========== cri ==========
# crictl binary
crictl_version: v1.31.1
# ========== cri: docker ==========
# docker binary
# docker_version: 27.3.1
# cridockerd. Required when kube_version is greater than 1.24
# cridockerd_version: v0.3.15
# ========== cri: containerd ==========
# containerd binary
containerd_version: v1.7.24
# runc binary
runc_version: v1.2.3
# ========== cni ==========
# cni_plugins binary
# cni_plugins_version: v1.5.1
# ========== cni: calico ==========
# calicoctl binary
calico_version: v3.29.2
# ========== cni: cilium ==========
# cilium helm
# cilium_version: 1.16.0
# ========== cni: kubeovn ==========
# kubeovn helm
# kubeovn_version: 0.1.0
# ========== cni: hybridnet ==========
# hybridnet helm
# hybridnet_version: 0.6.8
# ========== storageclass ==========
# ========== storageclass: nfs ==========
# nfs provisioner helm version
# nfs_provisioner_version: 4.0.18
kubernetes:
controller_manager:
extra_args:
cluster-signing-duration: 87600h
cri:
sandbox_image_tag: 3.10
# support: containerd,docker
container_manager: containerd

View File

@ -8,7 +8,11 @@ cri:
# the endpoint of containerd
cri_socket: |
{{- if .cri.container_manager | eq "containerd" }}
unix:///var/run/containerd.sock
unix:///var/run/containerd/containerd.sock
{{- else if and (.cri.container_manager | eq "docker") (.kube_version | semverCompare ">=v1.24.0") }}
unix:///var/run/cri-dockerd.sock
{{- else if and (.cri.container_manager | eq "docker") (.kube_version | semverCompare "<v1.24.0") }}
unix:///var/run/docker.sock
{{- end }}
containerd:
data_root: /var/lib/containerd

View File

@ -26,7 +26,7 @@
{{ .tmp_dir }}/containerd-{{ .containerd_version | default "" | trimPrefix "v" }}-linux-{{ .binary_type.stdout }}.tar.gz
- name: Unpackage containerd binary
command: |
tar -xvf {{ .tmp_dir }}/containerd-{{ .containerd_version | default "" | trimPrefix "v" }}-linux-{{ .binary_type.stdout }}.tar.gz -C /usr/local/bin/
tar -xvf {{ .tmp_dir }}/containerd-{{ .containerd_version | default "" | trimPrefix "v" }}-linux-{{ .binary_type.stdout }}.tar.gz --strip-components=1 -C /usr/local/bin/
- name: Generate containerd config file
template:
src: containerd.config

View File

@ -10,16 +10,12 @@
- name: Sync cri-dockerd Binary to remote
copy:
src: |
{{ .binary_dir }}/cri-dockerd/{{ .cridockerd_version }}/{{ .binary_type.stdout }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}-{{ .binary_type.stdout }}.tgz
{{ .binary_dir }}/cri-dockerd/{{ .cridockerd_version }}/{{ .binary_type.stdout }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}.{{ .binary_type.stdout }}.tgz
dest: |
{{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}-{{ .binary_type.stdout }}.tgz
- name: Generate cri-dockerd config file
template:
src: cri-dockerd.config
dest: /etc/cri-dockerd.yaml
{{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}.{{ .binary_type.stdout }}.tgz
- name: Unpackage cri-dockerd binary
command: |
tar -xvf {{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}-{{ .binary_type.stdout }}.tgz -C /usr/local/bin/
tar -xvf {{ .tmp_dir }}/cri-dockerd-{{ .cridockerd_version | default "" | trimPrefix "v" }}.{{ .binary_type.stdout }}.tgz --strip-components=1 -C /usr/local/bin/
- name: Generate cri-dockerd Service file
template:
src: cri-dockerd.service

View File

@ -1,6 +1,6 @@
version = 2
root = {{ .cri.containerd.data_root | default "/var/lib/containerd" }}
root = "{{ .cri.containerd.data_root | default "/var/lib/containerd" }}"
state = "/run/containerd"
[grpc]
@ -40,7 +40,7 @@ state = "/run/containerd"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = {{ if .cri.cgroup_driver | eq "systemd") }}true{{ else }}false{{ end }}
SystemdCgroup = {{ if .cri.cgroup_driver | eq "systemd" }}true{{ else }}false{{ end }}
[plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "/opt/cni/bin"
conf_dir = "/etc/cni/net.d"
@ -66,8 +66,8 @@ state = "/run/containerd"
[plugins."io.containerd.grpc.v1.cri".registry.configs."{{ .image_registry.auth.registry }}".tls]
ca_file = "/etc/containerd/certs.d/{{ .image_registry.auth.registry }}/ca.crt"
cert_file = "/etc/containerd/certs.d/{{ .image_registry.auth.registry }}/server.crt"
key_file = "/etc/containerd/certs.d/{{ image_registry.auth.registry }}/server.key"
{{ -end }}
key_file = "/etc/containerd/certs.d/{{ .image_registry.auth.registry }}/server.key"
{{- end }}
{{- if .cri.registry.auths | len | lt 0 }}
{{- range .cri.registry.auths }}
[plugins."io.containerd.grpc.v1.cri".registry.configs."{{ .repo }}".auth]