diff --git a/auto-build.sh b/auto-build.sh index 5bf1af2..dcfa748 100644 --- a/auto-build.sh +++ b/auto-build.sh @@ -87,19 +87,20 @@ sudo chmod +x version.sh download.sh && export kube_install_version="$k8s_versio ./download.sh "${cri}" sudo chmod +x amd64/bin/kube* && sudo chmod +x arm64/bin/kube* -#download v0.9.1 sealer -sudo wget https://github.com/sealerio/sealer/releases/download/v0.9.1/sealer-v0.9.1-linux-amd64.tar.gz && tar -xvf sealer-v0.9.1-linux-amd64.tar.gz -C /usr/bin +#download v0.9.2 sealer +sudo wget https://github.com/sealerio/sealer/releases/download/v0.9.2/sealer-v0.9.2-linux-amd64.tar.gz && tar -xvf sealer-v0.9.2-linux-amd64.tar.gz -C /usr/bin sudo sed -i "s/v1.19.8/$k8s_version/g" rootfs/etc/kubeadm.yml ##change k8s_version sudo sed -i "s/v1.19.8/$k8s_version/g" rootfs/etc/kubeadm.yml.tmpl ##change k8s_version if [[ "$cri" == "containerd" ]]; then sudo sed -i "s/\/var\/run\/dockershim.sock/\/run\/containerd\/containerd.sock/g" rootfs/etc/kubeadm.yml; fi if [[ "$cri" == "containerd" ]]; then sudo sed -i "s/\/var\/run\/dockershim.sock/\/run\/containerd\/containerd.sock/g" rootfs/etc/kubeadm.yml.tmpl; fi -sudo sed -i "s/kubeadm.k8s.io\/v1beta2/$kubeadmApiVersion/g" rootfs/etc/kubeadm.yml -sudo sed -i "s/kubeadm.k8s.io\/v1beta2/$kubeadmApiVersion/g" rootfs/etc/kubeadm.yml.tmpl +sudo sed -i "s/kubeadm.k8s.io\/v1beta3/$kubeadmApiVersion/g" rootfs/etc/kubeadm.yml +sudo sed -i "s/kubeadm.k8s.io\/v1beta3/$kubeadmApiVersion/g" rootfs/etc/kubeadm.yml.tmpl sudo ./"${ARCH}"/bin/kubeadm config images list --config "rootfs/etc/kubeadm.yml" sudo mkdir -p rootfs/manifests sudo ./"${ARCH}"/bin/kubeadm config images list --config "rootfs/etc/kubeadm.yml" 2>/dev/null | sed "/WARNING/d" >>imageList if [ "$(sudo ./"${ARCH}"/bin/kubeadm config images list --config rootfs/etc/kubeadm.yml 2>/dev/null | grep -c "coredns/coredns")" -gt 0 ]; then sudo sed -i "s/#imageRepository/imageRepository/g" rootfs/etc/kubeadm.yml.tmpl; fi -sudo sed -i "s/k8s.gcr.io/sea.hub:5000/g" rootfs/etc/kubeadm.yml.tmpl +#if [ "$(sudo ./"${ARCH}"/bin/kubeadm config images list --config rootfs/etc/kubeadm.yml 2>/dev/null | grep -c "coredns/coredns")" -gt 0 ]; then sudo sed -i "s/#imageRepository/imageRepository/g" rootfs/etc/kubeadm.yml; fi +sudo sed -i "s/registry.k8s.io/sea.hub:5000/g" rootfs/etc/kubeadm.yml.tmpl pauseImage=$(./"${ARCH}"/bin/kubeadm config images list --config "rootfs/etc/kubeadm.yml" 2>/dev/null | sed "/WARNING/d" | grep pause) if [ -f "rootfs/etc/dump-config.toml" ]; then sudo sed -i "s/sea.hub:5000\/pause:3.6/$(echo "$pauseImage" | sed 's/\//\\\//g')/g" rootfs/etc/dump-config.toml; fi sudo sealer build -t "docker.io/sealerio/kubernetes:${k8s_version}" -f Kubefile @@ -108,4 +109,4 @@ if [[ "$push" == "true" ]]; then sudo sealer login "$(echo "docker.io" | cut -d "/" -f1)" -u "${username}" -p "${password}" fi sudo sealer push "docker.io/sealerio/kubernetes:${k8s_version}" -fi +fi \ No newline at end of file diff --git a/context/rootfs/etc/kubeadm.yml b/context/rootfs/etc/kubeadm.yml index d512c22..f7b2c50 100644 --- a/context/rootfs/etc/kubeadm.yml +++ b/context/rootfs/etc/kubeadm.yml @@ -1,4 +1,4 @@ -apiVersion: kubeadm.k8s.io/v1beta2 +apiVersion: kubeadm.k8s.io/v1beta3 kind: InitConfiguration localAPIEndpoint: bindPort: 6443 @@ -31,7 +31,7 @@ apiServer: name: localtime pathType: File readOnly: true -apiVersion: kubeadm.k8s.io/v1beta2 +apiVersion: kubeadm.k8s.io/v1beta3 controllerManager: extraArgs: experimental-cluster-signing-duration: 876000h @@ -44,13 +44,13 @@ controllerManager: readOnly: true dns: type: "" - #imageRepository: sea.hub:5000/coredns + imageRepository: registry.k8s.io/coredns etcd: local: dataDir: "" extraArgs: listen-metrics-urls: http://0.0.0.0:2381 -imageRepository: k8s.gcr.io +imageRepository: registry.k8s.io kind: ClusterConfiguration kubernetesVersion: v1.19.8 networking: @@ -66,7 +66,7 @@ scheduler: pathType: File readOnly: true --- -apiVersion: kubeadm.k8s.io/v1beta2 +apiVersion: kubeadm.k8s.io/v1beta3 kind: JoinConfiguration caCertPath: /etc/kubernetes/pki/ca.crt discovery: diff --git a/context/rootfs/etc/kubeadm.yml.tmpl b/context/rootfs/etc/kubeadm.yml.tmpl index 06891b6..07f3730 100644 --- a/context/rootfs/etc/kubeadm.yml.tmpl +++ b/context/rootfs/etc/kubeadm.yml.tmpl @@ -1,4 +1,4 @@ -apiVersion: kubeadm.k8s.io/v1beta2 +apiVersion: kubeadm.k8s.io/v1beta3 kind: InitConfiguration localAPIEndpoint: advertiseAddress: 172.16.0.181 @@ -34,7 +34,7 @@ apiServer: name: localtime pathType: File readOnly: true -apiVersion: kubeadm.k8s.io/v1beta2 +apiVersion: kubeadm.k8s.io/v1beta3 controlPlaneEndpoint: apiserver.cluster.local:6443 controllerManager: extraArgs: @@ -48,7 +48,7 @@ controllerManager: readOnly: true dns: type: "" - #imageRepository: {{or .RegistryURL "sea.hub:5000"}}/coredns + imageRepository: {{or .RegistryURL "sea.hub:5000"}}/coredns etcd: local: dataDir: "" @@ -70,6 +70,18 @@ scheduler: pathType: File readOnly: true +--- +apiVersion: kubeadm.k8s.io/v1beta3 +kind: JoinConfiguration +caCertPath: /etc/kubernetes/pki/ca.crt +discovery: + timeout: 5m0s +nodeRegistration: + criSocket: /var/run/dockershim.sock +controlPlane: + localAPIEndpoint: + bindPort: 6443 + --- apiVersion: kubelet.config.k8s.io/v1beta1 authentication: @@ -85,7 +97,7 @@ authorization: webhook: cacheAuthorizedTTL: 5m0s cacheUnauthorizedTTL: 30s -cgroupDriver: cgroupfs +cgroupDriver: systemd cgroupsPerQOS: true clusterDomain: cluster.local configMapAndSecretChangeDetectionStrategy: Watch @@ -99,7 +111,7 @@ cpuManagerReconcilePeriod: 10s enableControllerAttachDetach: true enableDebuggingHandlers: true enforceNodeAllocatable: -- pods + - pods eventBurst: 10 eventRecordQPS: 5 evictionHard: @@ -172,7 +184,7 @@ iptables: syncPeriod: 0s ipvs: excludeCIDRs: - - 10.103.97.2/32 + - 10.103.97.2/32 minSyncPeriod: 0s scheduler: "" strictARP: false @@ -191,4 +203,4 @@ udpIdleTimeout: 0s winkernel: enableDSR: false networkName: "" - sourceVip: "" + sourceVip: "" \ No newline at end of file