Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: K8S原生集群增加1.27.15 和1.28.11版本 #3312

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions bcs-ops/env/offline-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,63 @@ bcs-ops:
- hub.bktencent.com/alpine/helm:3.7.2
- hub.bktencent.com/registry.k8s.io/ingress-nginx/controller:v1.3.1
- hub.bktencent.com/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0

- version: "1.27.15"
bin-tools:
k8s: "1.27.15"
cni-plugins: "1.3.0"
crictl: "1.24.2"
containerd: "1.6.21"
runc: "1.1.8"
jq: "1.6"
yq: "4.30.6"

images:
- hub.bktencent.com/registry.k8s.io/kube-apiserver:v1.27.15
- hub.bktencent.com/registry.k8s.io/kube-controller-manager:v1.27.15
- hub.bktencent.com/registry.k8s.io/kube-scheduler:v1.27.15
- hub.bktencent.com/registry.k8s.io/kube-proxy:v1.27.15
- hub.bktencent.com/registry.k8s.io/pause:3.9
- hub.bktencent.com/registry.k8s.io/etcd:3.5.12-0
- hub.bktencent.com/registry.k8s.io/coredns:v1.10.1
- hub.bktencent.com/library/hello-world:latest
- hub.bktencent.com/flannel/flannel-cni-plugin:v1.1.2
- hub.bktencent.com/flannel/flannel:v0.22.0
- hub.bktencent.com/k8s.gcr.io/sig-storage/local-volume-provisioner:v2.4.0
- hub.bktencent.com/registry.k8s.io/metrics-server/metrics-server:v0.6.3
- hub.bktencent.com/registry.k8s.io/multus-cni:snapshot
- hub.bktencent.com/registry.k8s.io/kube-vip:v0.5.12
- hub.bktencent.com/blueking/bcs-apiserver-proxy:v1.29.0-alpha.130-tencent
- hub.bktencent.com/alpine/helm:3.7.2
- hub.bktencent.com/registry.k8s.io/ingress-nginx/controller:v1.3.1
- hub.bktencent.com/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0

- version: "1.28.11"
bin-tools:
k8s: "1.28.11"
cni-plugins: "1.3.0"
crictl: "1.24.2"
containerd: "1.6.21"
runc: "1.1.8"
jq: "1.6"
yq: "4.30.6"

images:
- hub.bktencent.com/registry.k8s.io/kube-apiserver:v1.28.11
- hub.bktencent.com/registry.k8s.io/kube-controller-manager:v1.28.11
- hub.bktencent.com/registry.k8s.io/kube-scheduler:v1.28.11
- hub.bktencent.com/registry.k8s.io/kube-proxy:v1.28.11
- hub.bktencent.com/registry.k8s.io/pause:3.9
- hub.bktencent.com/registry.k8s.io/etcd:3.5.12-0
- hub.bktencent.com/registry.k8s.io/coredns:v1.10.1
- hub.bktencent.com/library/hello-world:latest
- hub.bktencent.com/flannel/flannel-cni-plugin:v1.1.2
- hub.bktencent.com/flannel/flannel:v0.22.0
- hub.bktencent.com/k8s.gcr.io/sig-storage/local-volume-provisioner:v2.4.0
- hub.bktencent.com/registry.k8s.io/metrics-server/metrics-server:v0.6.3
- hub.bktencent.com/registry.k8s.io/multus-cni:snapshot
- hub.bktencent.com/registry.k8s.io/kube-vip:v0.5.12
- hub.bktencent.com/blueking/bcs-apiserver-proxy:v1.29.0-alpha.130-tencent
- hub.bktencent.com/alpine/helm:3.7.2
- hub.bktencent.com/registry.k8s.io/ingress-nginx/controller:v1.3.1
- hub.bktencent.com/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0
14 changes: 14 additions & 0 deletions bcs-ops/k8s/install_k8s_tools
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ name=Kubernetes
baseurl=${repo_url}
enabled=1
gpgcheck=0

[kubernetes-v1.27]
name=Kubernetes
baseurl=https://mirrors.tencent.com/kubernetes_new/core%3a/stable%3a/v1.27%3a/build/rpm/
enabled=1
gpgcheck=0

[kubernetes-v1.28]
name=Kubernetes
baseurl=https://mirrors.tencent.com/kubernetes_new/core%3a/stable%3a/v1.28%3a/build/rpm/
enabled=1
gpgcheck=0
EOF
yum install -y -q yum-utils
yum-config-manager --add-repo "$ROOT_DIR/kubernetes.repo"
Expand Down Expand Up @@ -218,6 +230,8 @@ main() {
utils::log "INFO" "check kubectl status"
if kubectl version --client --short; then
utils::log "OK" "kubelet install success"
elif kubectl version --client ; then
utils::log "OK" "kubelet install success"
else
utils::log "ERROR" "Did kubectl get installed?"
fi
Expand Down
5 changes: 4 additions & 1 deletion bcs-ops/k8s/render_kubeadm
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,12 @@ main() {
1.2[2-4].*)
kubeadm_tag="v1beta3"
;;
1.2[7-8].*)
kubeadm_tag="v1beta3"
;;
*)
utils::log "FATAL" \
"Only support 1.2[0-4].x, here is :${K8S_VER}"
"Only support 1.2[0-8].x, here is :${K8S_VER}"
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion bcs-ops/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set +x

## 安装示例

目前仅支持 k8s `1.20.15` (默认), `1.23.17` `1.24.15` 版本。
目前仅支持 k8s `1.20.15` (默认), `1.23.17` , `1.24.15` , `1.27.15`, `1.28.11`版本。

### 集群创建与节点添加

Expand Down
4 changes: 2 additions & 2 deletions bcs-ops/system/config_envfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ EOF
check_env() {
trap "utils::on_ERR;" ERR
# match k8s_ver
if ! [[ $K8S_VER =~ ^1\.2[0-4] ]]; then
if ! [[ $K8S_VER =~ ^1\.2[0-8] ]]; then
utils::log "ERROR" \
"Only support K8S_VER 1.2[0-4].x, here is :${K8S_VER}"
"Only support K8S_VER 1.2[0-8].x, here is :${K8S_VER}"
fi

# match cri and k8s_ver
Expand Down
19 changes: 10 additions & 9 deletions bcs-ops/system/get_lan_ip
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,18 @@ _on_cloud() {
}

_on_baremetal() {
if ! ip route show | grep -q "default via"; then
error "fail to obtain LAN_IP, default route missing" >&2
exit 2
fi
LAN_IP=$(ip -4 -o route get 10/8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')
if [[ -n $LAN_IP ]]; then
echo "$LAN_IP"
if ip route show | grep -q "default via"; then
LAN_IP=$(ip -4 -o route get 10/8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')
if [[ -n $LAN_IP ]]; then
echo "$LAN_IP"
return 0
fi
error "fail to obtain LAN_IP" >&2
exit 1
else
LAN_IP=$(hostname -I |awk ' { print $1 } ')
return 0
fi
error "fail to obtain LAN_IP" >&2
exit 1
}

_on_baremetal_v6() {
Expand Down
52 changes: 35 additions & 17 deletions bcs-ops/system/init_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,43 @@ set_yum_repo() {
if [ "$whichWget" == "" ]; then
yum install wget -y 2>&1 >/dev/null
fi
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$BACKUPTIME
wget -O /etc/yum.repos.d/CentOS-Base.repo $BASE_YUM_LINK
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.$BACKUPTIME
wget -O /etc/yum.repos.d/epel.repo $BASE_EPEL_LINK

if [[ -f /etc/tlinux-release ]];then
if grep "TencentOS Server 3.[0-9]*" /etc/tlinux-release;then
sed -i "s/\$releasever/8/g" /etc/yum.repos.d/epel.repo
sed -i "s/\$releasever/8/g" /etc/yum.repos.d/CentOS-Base.repo
elif grep "TencentOS Server 2.[0-9]*" /etc/tlinux-release;then
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/epel.repo
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/CentOS-Base.repo
elif grep "Tencent tlinux release 2.[0-9]*" /etc/tlinux-release;then
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/epel.repo
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/CentOS-Base.repo

if ! grep -r BaseOS /etc/yum.repos.d/;then

if [[ -f /etc/tlinux-release ]];then
if grep "TencentOS Server 3.[0-9]*" /etc/tlinux-release;then
BASE_YUM_LINK="http://mirrors.cloud.tencent.com/repo/centos8_base.repo"
elif grep "TencentOS Server 2.[0-9]*" /etc/tlinux-release;then
BASE_YUM_LINK="http://mirrors.cloud.tencent.com/repo/centos7_base.repo"
BASE_EPEL_LINK="http://mirrors.cloud.tencent.com/repo/epel-7.repo"
elif grep "Tencent tlinux release 2.[0-9]*" /etc/tlinux-release;then
BASE_YUM_LINK="http://mirrors.cloud.tencent.com/repo/centos7_base.repo"
BASE_EPEL_LINK="http://mirrors.cloud.tencent.com/repo/epel-7.repo"
fi
fi


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$BACKUPTIME
wget -O /etc/yum.repos.d/CentOS-Base.repo $BASE_YUM_LINK
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.$BACKUPTIME
wget -O /etc/yum.repos.d/epel.repo $BASE_EPEL_LINK

if [[ -f /etc/tlinux-release ]];then
if grep "TencentOS Server 3.[0-9]*" /etc/tlinux-release;then
sed -i "s/\$releasever/8/g" /etc/yum.repos.d/epel.repo
sed -i "s/\$releasever/8/g" /etc/yum.repos.d/CentOS-Base.repo
elif grep "TencentOS Server 2.[0-9]*" /etc/tlinux-release;then
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/epel.repo
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/CentOS-Base.repo
elif grep "Tencent tlinux release 2.[0-9]*" /etc/tlinux-release;then
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/epel.repo
sed -i "s/\$releasever/7/g" /etc/yum.repos.d/CentOS-Base.repo
fi
fi

yum clean all
yum makecache
fi
yum clean all
yum makecache

curr=$(yum repolist | grep EPEL | awk '{print $2,$3,$4,$5}')
if [ "$curr" == "EPEL for redhat/centos 7" ]; then
Expand Down
Loading