kubeasz 制作(k8s)kubernetes集群离线安装包
本文介绍了,利用 ezdown 制作 kubeasz 离线部署 k8s 集群所需的离线安装包。使用 kubeasz 离线安装 k8s 集群需要下载四个部分:kubeasz 项目代码二进制文件(k8s、etcd、containerd 等组件)容器镜像文件(calico、coredns、metrics-server 等容器镜像)系统软件安装包(ipset、libseccomp2 等,仅无法使用本地 y
转载:kubeasz 制作k8s 集群离线安装包
kubeasz 制作k8s 集群离线安装包
大家好,欢迎来到运维有术
本文介绍了,利用 ezdown 制作 kubeasz 离线部署 k8s 集群所需的离线安装包。
使用 kubeasz 离线安装 k8s 集群需要下载四个部分:
-
kubeasz 项目代码
-
二进制文件(k8s、etcd、containerd 等组件)
-
容器镜像文件(calico、coredns、metrics-server 等容器镜像)
-
系统软件安装包(ipset、libseccomp2 等,仅无法使用本地 yum/apt 源时需要)
1. 离线文件准备
1.1 下载工具脚本 ezdown
本文使用 kubeasz 版本 3.6.1
在一台能够访问互联网的服务器上执行下面的命令(这不是废话么)
export release=3.6.1
wget https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
chmod +x ./ezdown
export release=3.6.1
wget https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
chmod +x ./ezdown
脚本在 GitHub上 可能需要多次尝试
看看 ezdown 都有哪些命令参数
注意:以下输出受限于规则而造成了缺失,请以实际结果为准。
[root@localhost ~]# ./ezdown
Usage: ezdown [options] [args]
option:
-C stop&clean all local containers
-D download default binaries/images into "/etc/kubeasz"
-P <OS> download system packages of the OS (ubuntu_22,debian_11,...)
-R download Registry(harbor) offline installer
-S start kubeasz in a container
-X <opt> download extra images
-d <ver> set docker-ce version, default "20.10.24"
-e <ver> set kubeasz-ext-bin version, default "1.7.1"
-k <ver> set kubeasz-k8s-bin version, default "v1.27.2"
-z <ver> set kubeasz version, default "3.6.1"
1.2 使用工具脚本下载离线文件
-
下载 kubeasz 代码、二进制、默认容器镜像
# 国内环境
./ezdown -D
-
下载额外插件
./ezdown -X prometheus
./ezdown -X nfs-provisioner
其他可用的插件,没有找到文档介绍,可以查看源代码 https://github.com/easzlab/kubeasz/blob/master/ezdown
function usage-down-ext-img(){
echo -e "\033[33mUsage:\033[0m ezdown -X <opt>"
cat <<EOF
available options:
cilium to download images of cilium
flannel to download images of flannel
kube-ovn to download images of kube-ovn
kube-router to download images of kube-router
kubeapps to download images of kubeapps
local-path-provisioner to download images of local-path-provisioner
network-check to download images of network-check
nfs-provisioner to download images of nfs-provisioner
prometheus to download images of prometheus
examples:
./ezdown -X prometheus
EOF
}
-
下载离线操作系统包
# 文本选用centos7
./ezdown -P centos_7
具体支持的操作系统类型和对应参数,需要查看源码 https://github.com/easzlab/kubeasz/blob/master/ezdown
function usage-down-sys-pkg(){
echo -e "\033[33mUsage:\033[0m ezdown -P <OS>"
cat <<EOF
available OSes:
almalinux_8 to download package of AlmaLinux 8
almalinux_9 to download package of AlmaLinux 9
centos_7 to download package of CentOS 7
debian_10 to download package of Debian 10
debian_11 to download package of Debian 11
fedora_34 to download package of Fedora 34
fedora_35 to download package of Fedora 35
fedora_36 to download package of Fedora 36
fedora_37 to download package of Fedora 37
opensuse_leap_15 to download package of openSUSE Leap 15
rocky_8 to download package of Rocky Linux 8
rocky_9 to download package of Rocky Linux 9
ubuntu_16 to download package of Ubuntu 16.04
ubuntu_18 to download package of Ubuntu 18.04
ubuntu_20 to download package of Ubuntu 20.04
ubuntu_22 to download package of Ubuntu 22.04
examples:
./ezdown -P ubuntu_22
EOF
}
上述脚本运行成功后,所有文件(kubeasz代码、二进制、离线镜像)均已整理好放入目录/etc/kubeasz
-
/etc/kubeasz
包含 kubeasz 版本为 ${release} 的发布代码 -
/etc/kubeasz/bin
包含 k8s/etcd/docker/cni 等二进制文件 -
/etc/kubeasz/down
包含集群安装时需要的离线容器镜像 -
/etc/kubeasz/down/packages
包含集群安装时需要的系统基础软件
[root@localhost ~]# ll -h /etc/kubeasz/
total 104K
-rw-rw-r--. 1 root root 20K May 28 00:32 ansible.cfg
drwxr-xr-x. 4 root root 4.0K Jul 11 02:51 bin
drwxrwxr-x. 8 root root 94 May 28 00:38 docs
drwxr-xr-x. 4 root root 4.0K Jul 11 03:28 down
drwxrwxr-x. 2 root root 70 May 28 00:38 example
-rwxrwxr-x. 1 root root 26K May 28 00:32 ezctl
-rwxrwxr-x. 1 root root 32K May 28 00:32 ezdown
drwxrwxr-x. 10 root root 145 May 28 00:38 manifests
drwxrwxr-x. 2 root root 94 May 28 00:38 pics
drwxrwxr-x. 2 root root 4.0K May 28 00:38 playbooks
-rw-rw-r--. 1 root root 5.9K May 28 00:32 README.md
drwxrwxr-x. 22 root root 4.0K May 28 00:38 roles
drwxrwxr-x. 2 root root 74 May 28 00:38 tools
[root@localhost ~]# ll -h /etc/kubeasz/bin/
total 1.1G
-rwxr-xr-x. 1 root root 57M Nov 7 2022 calicoctl
-rwxr-xr-x. 1 root root 14M Apr 1 19:05 cfssl
-rwxr-xr-x. 1 root root 12M Apr 1 19:05 cfssl-certinfo
-rwxr-xr-x. 1 root root 7.5M Apr 1 19:05 cfssljson
-rwxr-xr-x. 1 root root 1.1M Jan 10 04:48 chronyd
-rwxr-xr-x. 1 root root 72M Mar 21 03:30 cilium
drwxr-xr-x. 2 root root 248 Apr 1 19:05 cni-bin
-rwxr-xr-x. 1 root root 38M Jul 11 02:40 containerd
drwxr-xr-x. 2 root root 157 Apr 1 19:05 containerd-bin
-rwxr-xr-x. 1 root root 7.2M Jul 11 02:40 containerd-shim
-rwxr-xr-x. 1 root root 9.4M Jul 11 02:40 containerd-shim-runc-v2
-rwxr-xr-x. 1 root root 52M Mar 15 09:57 crictl
-rwxr-xr-x. 1 root root 21M Jul 11 02:40 ctr
-rwxr-xr-x. 1 root root 46M Jul 11 02:40 docker
-rwxr-xr-x. 1 root root 52M Mar 26 10:37 docker-compose
-rwxr-xr-x. 1 root root 56M Jul 11 02:40 dockerd
-rwxr-xr-x. 1 root root 748K Jul 11 02:40 docker-init
-rwxr-xr-x. 1 root root 2.6M Jul 11 02:40 docker-proxy
-rwxr-xr-x. 1 root root 23M Nov 21 2022 etcd
-rwxr-xr-x. 1 root root 18M Nov 21 2022 etcdctl
-rwxr-xr-x. 1 root root 45M Mar 8 16:17 helm
-rwxr-xr-x. 1 root root 21M Mar 15 08:03 hubble
-rwxr-xr-x. 1 root root 1.8M Jan 10 04:49 keepalived
-rwxr-xr-x. 1 root root 112M May 17 10:33 kube-apiserver
-rwxr-xr-x. 1 root root 104M May 17 10:33 kube-controller-manager
-rwxr-xr-x. 1 root root 47M May 17 10:33 kubectl
-rwxr-xr-x. 1 root root 102M May 17 10:33 kubelet
-rwxr-xr-x. 1 root root 51M May 17 10:33 kube-proxy
-rwxr-xr-x. 1 root root 52M May 17 10:33 kube-scheduler
-rwxr-xr-x. 1 root root 1.8M Jan 10 04:48 nginx
-rwxr-xr-x. 1 root root 14M Jul 11 02:40 runc
[root@localhost ~]# ll -h /etc/kubeasz/down/
total 2.1G
-rw-------. 1 root root 514M Jul 11 02:56 calico_v3.24.6.tar
-rw-------. 1 root root 47M Jul 11 02:57 coredns_1.9.3.tar
-rw-------. 1 root root 238M Jul 11 02:58 dashboard_v2.7.0.tar
drwxrwxr-x. 2 1000 1000 6 Jul 11 02:40 docker
-rw-r--r--. 1 root root 64M Apr 4 17:19 docker-20.10.24.tgz
-rw-------. 1 root root 67M Jul 11 02:57 k8s-dns-node-cache_1.22.20.tar
-rw-------. 1 root root 159M Jul 11 02:42 kubeasz_3.6.1.tar
-rw-------. 1 root root 42M Jul 11 02:59 metrics-scraper_v1.0.8.tar
-rw-------. 1 root root 68M Jul 11 02:59 metrics-server_v0.6.3.tar
-rw-------. 1 root root 43M Jul 11 03:22 nfs-provisioner_v4.0.2.tar
drwxr-xr-x. 2 root root 26 May 5 04:44 packages
-rw-------. 1 root root 738K Jul 11 02:59 pause_3.9.tar
-rw-------. 1 root root 855M Jul 11 03:21 prometheus-chart_45.23.0.tar
-rw-------. 1 root root 24M Jul 11 02:51 registry-2.tar
[root@localhost ~]# ll -h /etc/kubeasz/down/packages/
total 3.1M
-rw-r--r--. 1 root root 3.1M May 5 04:44 centos_7.tgz
通过执行上面的操作,我们完成了 kubeasz 离线部署 k8s 集群所需离线包的下载,下一期我们实战如何利用离线包安装部署 3 个 Master 节点 的 k8s 集群。
更多推荐
所有评论(0)