活动介绍
file-type

Kubernetes-in-Docker快速搭建单节点集群以支持CI测试

ZIP文件

下载需积分: 5 | 17KB | 更新于2025-08-13 | 191 浏览量 | 0 下载量 举报 收藏
download 立即下载
### Kubernetes-in-Docker简介 Kubernetes-in-Docker(简称kind)是一个工具,其目的是在CI(持续集成)环境中快速创建和销毁Kubernetes集群实例。它允许开发者在本地快速启动一个单节点Kubernetes集群,并在30秒之内完成环境的搭建。这对于需要频繁进行CI测试的场景非常有用,因为它可以在每次测试前提供一个干净的环境,从而避免了测试之间的相互干扰。 ### Docker-in-Docker(DIND)与kind的区别 Docker-in-Docker(DIND)是指在Docker容器内部运行另一个Docker守护进程的技术,它允许在容器中执行Docker命令,仿佛是直接在宿主机上运行一样。然而,kind与DIND不同的是,kind专为运行完整的Kubernetes集群而设计,旨在支持CI工作流中的环境隔离和快速重置。kind的启动速度和短暂性是它区别于其他Kubernetes集群部署选项的关键特性。 ### Kubernetes集群的CI/CD集成 在CI/CD(持续集成/持续部署)流程中集成Kubernetes集群有其独特的优势和挑战。开发者可以在实际部署到生产环境之前,在CI环境中验证和测试代码的改变。在kind提供的单节点Kubernetes集群上运行CI测试,可以确保每次提交都能够在隔离的环境中进行完整的集成测试,从而保证代码质量和环境的稳定性。 ### kind的快速开始指南 kind提供了使用DockerHub上预构建映像的快速开始指南。用户只需运行一个Docker命令就可以创建一个kind实例。例如,使用`bsycorp/kind:latest-1.12`这个预构建映像,通过`docker run`命令可以快速启动一个包含单个控制平面节点和一个工作节点的Kubernetes集群。这使得开发者能够在本地环境中拥有一个功能齐全的Kubernetes环境,以执行各种测试和验证。 ### 安全性和性能 在CI环境中运行Kubernetes集群需要考虑到安全性和性能。kind允许用户通过`--privileged`标志以特权模式运行容器,这可能会带来安全风险,因此在生产环境部署时需要特别谨慎。尽管如此,kind在CI场景下提供了不可替代的便利性,特别是在需要快速启动集群实例并频繁重置环境的场景中。 ### kind的特点和优势 - **快速启动**:能够以极快的速度启动Kubernetes集群,通常在30秒内即可完成。 - **短暂性**:集群是完全短暂的,意味着每次CI运行结束后环境会自动销毁,保证了环境的一致性和清洁。 - **简易部署**:通过使用Dockerhub上的预构建映像,kind简化了安装和配置的过程。 - **CI友好**:特别适合于CI/CD工作流,使得每次代码变更都能快速而可靠地进行测试。 - **本地开发环境**:允许开发者在本地环境中模拟生产环境,减少了开发者机器之间的环境不一致问题。 ### 使用场景 kind特别适合以下使用场景: - 开发者需要频繁地对Kubernetes应用进行本地测试和调试。 - CI系统需要快速搭建一个干净的Kubernetes环境,以确保每次测试的独立性和一致性。 - 持续集成环境中需要快速验证应用在Kubernetes集群中的行为。 - 开发团队希望在本地模拟Kubernetes集群,以测试复杂的部署场景。 ### 总结 kind为开发者和运维团队提供了一种便捷的方式,在CI流程中快速、干净地部署和测试Kubernetes集群。通过使用kind,可以在保持环境隔离的同时,大幅度提高CI测试的效率和可靠性。这不仅降低了Kubernetes部署的门槛,也为CI/CD工作流带来了灵活性和可控性。

相关推荐

filetype

[root@localhost opt]# ./download_k8s_offline.sh ======================================== Kubernetes 离线部署包生成脚本 (v3.1) ======================================== 🔄 配置系统仓库... Repository epel is listed more than once in the configuration Docker CE Stable 9.6 kB/s | 3.5 kB 00:00 Kubernetes 5.3 kB/s | 1.4 kB 00:00 软件包 epel-release-8-22.el8.noarch 已安装。 依赖关系解决。 无需任何处理。 完毕! 🔄 创建 yum 缓存(不使用 fast 参数)... Repository epel is listed more than once in the configuration 38 文件已删除 Repository epel is listed more than once in the configuration CentOS-8 - BaseOS - mirrors.aliyun.com 4.2 MB/s | 4.6 MB 00:01 CentOS-8 - AppStream - mirrors.aliyun.com 6.0 MB/s | 8.4 MB 00:01 CentOS-8 - Extras - mirrors.aliyun.com 23 kB/s | 10 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 7.1 MB/s | 14 MB 00:01 Docker CE Stable 145 kB/s | 79 kB 00:00 Kubernetes 297 kB/s | 182 kB 00:00 元数据缓存已建立。 ✅ 仓库配置完成 🛠️ 安装必要工具... Repository epel is listed more than once in the configuration 上次元数据过期检查:0:00:09 前,执行于 2025年07月25日 星期五 04时51分38秒。 软件包 yum-utils-4.0.21-3.el8.noarch 已安装。 软件包 createrepo_c-0.17.2-3.el8.x86_64 已安装。 软件包 wget-1.19.5-10.el8.x86_64 已安装。 软件包 curl-7.61.1-22.el8.x86_64 已安装。 软件包 jq-1.5-12.el8.x86_64 已安装。 依赖关系解决。 无需任何处理。 完毕! ✅ 工具安装完成 🔍 检测可用 Kubernetes 版本... 📋 可用 Kubernetes 版本: 1) 1.33.3 2) 1.33.2 3) 1.33.1 4) 1.33.0 5) 1.32.7 6) 1.32.6 7) 1.32.5 8) 1.32.4 9) 1.32.3 10) 1.32.2 11) 1.28.2-0 12) 1.28.1-0 13) 1.28.0-0 14) 1.27.6-0 15) 1.27.5-0 16) 1.27.4-0 17) 1.27.3-0 18) 1.27.2-0 19) 1.27.1-0 20) 1.27.0-0 21) 1.26.9-0 22) 1.26.8-0 23) 1.26.7-0 24) 1.26.6-0 25) 1.26.5-0 26) 1.26.4-0 27) 1.26.3-0 28) 1.26.2-0 29) 1.26.1-0 30) 1.26.0-0 31) 1.25.14-0 32) 1.25.13-0 33) 1.25.12-0 34) 1.25.11-0 35) 1.25.10-0 36) 1.25.9-0 37) 1.25.8-0 38) 1.25.7-0 39) 1.25.6-0 40) 1.25.5-0 41) 1.25.4-0 42) 1.25.3-0 43) 1.25.2-0 44) 1.25.1-0 45) 1.25.0-0 46) 1.24.17-0 47) 1.24.16-0 48) 1.24.15-0 49) 1.24.14-0 50) 1.24.13-0 51) 1.24.12-0 52) 1.24.11-0 53) 1.24.10-0 54) 1.24.9-0 55) 1.24.8-0 56) 1.24.7-0 57) 1.24.6-0 58) 1.24.5-0 59) 1.24.4-0 60) 1.24.3-0 61) 1.24.2-0 62) 1.24.1-0 63) 1.24.0-0 64) 1.23.17-0 65) 1.23.16-0 66) 1.23.15-0 67) 1.23.14-0 68) 1.23.13-0 69) 1.23.12-0 70) 1.23.11-0 71) 1.23.10-0 72) 1.23.9-0 73) 1.23.8-0 74) 1.23.7-0 75) 1.23.6-0 76) 1.23.5-0 77) 1.23.4-0 78) 1.23.3-0 79) 1.23.2-0 80) 1.23.1-0 81) 1.23.0-0 82) 1.22.17-0 83) 1.22.16-0 84) 1.22.15-0 85) 1.22.14-0 86) 1.22.13-0 87) 1.22.12-0 88) 1.22.11-0 89) 1.22.10-0 90) 1.22.9-0 91) 1.22.8-0 92) 1.22.7-0 93) 1.22.6-0 94) 1.22.5-0 95) 1.22.4-0 96) 1.22.3-0 97) 1.22.2-0 98) 1.22.1-0 99) 1.22.0-0 100) 1.21.14-0 101) 1.21.13-0 102) 1.21.12-0 103) 1.21.11-0 104) 1.21.10-0 105) 1.21.9-0 106) 1.21.8-0 107) 1.21.7-0 108) 1.21.6-0 109) 1.21.5-0 110) 1.21.4-0 111) 1.21.3-0 112) 1.21.2-0 113) 1.21.1-0 114) 1.21.0-0 115) 1.20.15-0 116) 1.20.14-0 117) 1.20.13-0 118) 1.20.12-0 119) 1.20.11-0 120) 1.20.10-0 121) 1.20.9-0 122) 1.20.8-0 123) 1.20.7-0 124) 1.20.6-0 125) 1.20.5-0 126) 1.20.4-0 127) 1.20.2-0 128) 1.20.1-0 129) 1.20.0-0 130) 1.19.16-0 131) 1.19.15-0 132) 1.19.14-0 133) 1.19.13-0 134) 1.19.12-0 135) 1.19.11-0 136) 1.19.10-0 137) 1.19.9-0 138) 1.19.8-0 139) 1.19.7-0 140) 1.19.6-0 141) 1.19.5-0 142) 1.19.4-0 143) 1.19.3-0 144) 1.19.2-0 145) 1.19.1-0 146) 1.19.0-0 147) 1.18.20-0 148) 1.18.19-0 149) 1.18.18-0 150) 1.18.17-0 151) 1.18.16-0 152) 1.18.15-0 153) 1.18.14-0 154) 1.18.13-0 155) 1.18.12-0 156) 1.18.10-0 157) 1.18.9-0 158) 1.18.8-0 159) 1.18.6-0 160) 1.18.5-0 161) 1.18.4-1 162) 1.18.4-0 163) 1.18.3-0 164) 1.18.2-0 165) 1.18.1-0 166) 1.18.0-0 167) 1.17.17-0 168) 1.17.16-0 169) 1.17.15-0 170) 1.17.14-0 171) 1.17.13-0 172) 1.17.12-0 173) 1.17.11-0 174) 1.17.9-0 175) 1.17.8-0 176) 1.17.7-1 177) 1.17.7-0 178) 1.17.6-0 179) 1.17.5-0 180) 1.17.4-0 181) 1.17.3-0 182) 1.17.2-0 183) 1.17.1-0 184) 1.17.0-0 185) 1.16.15-0 186) 1.16.14-0 187) 1.16.13-0 188) 1.16.12-0 189) 1.16.11-1 190) 1.16.11-0 191) 1.16.10-0 192) 1.16.9-0 193) 1.16.8-0 194) 1.16.7-0 195) 1.16.6-0 196) 1.16.5-0 197) 1.16.4-0 198) 1.16.3-0 199) 1.16.2-0 200) 1.16.1-0 201) 1.16.0-0 202) 1.15.12-0 203) 1.15.11-0 204) 1.15.10-0 205) 1.15.9-0 206) 1.15.8-0 207) 1.15.7-0 208) 1.15.6-0 209) 1.15.5-0 210) 1.15.4-0 211) 1.15.3-0 212) 1.15.2-0 213) 1.15.1-0 214) 1.15.0-0 215) 1.14.10-0 216) 1.14.9-0 217) 1.14.8-0 218) 1.14.7-0 219) 1.14.6-0 220) 1.14.5-0 221) 1.14.4-0 222) 1.14.3-0 223) 1.14.2-0 224) 1.14.1-0 225) 1.14.0-0 226) 1.13.12-0 227) 1.13.11-0 228) 1.13.10-0 229) 1.13.9-0 230) 1.13.8-0 231) 1.13.7-0 232) 1.13.6-0 233) 1.13.5-0 234) 1.13.4-0 235) 1.13.3-0 236) 1.13.2-0 237) 1.13.1-0 238) 1.13.0-0 239) 1.12.10-0 240) 1.12.9-0 241) 1.12.8-0 242) 1.12.7-0 243) 1.12.6-0 244) 1.12.5-0 245) 1.12.4-0 246) 1.12.3-0 247) 1.12.2-0 248) 1.12.1-0 249) 1.12.0-0 250) 1.11.10-0 251) 1.11.9-0 252) 1.11.8-0 253) 1.11.7-0 254) 1.11.6-0 255) 1.11.5-0 256) 1.11.4-0 257) 1.11.3-0 258) 1.11.2-0 259) 1.11.1-0 260) 1.11.0-0 261) 1.10.13-0 262) 1.10.12-0 263) 1.10.11-0 264) 1.10.10-0 265) 1.10.9-0 266) 1.10.8-0 267) 1.10.7-0 268) 1.10.6-0 269) 1.10.5-0 270) 1.10.4-0 271) 1.10.3-0 272) 1.10.2-0 273) 1.10.1-0 274) 1.10.0-0 275) 1.9.11-0 276) 1.9.10-0 277) 1.9.9-0 278) 1.9.8-0 279) 1.9.7-0 280) 1.9.6-0 281) 1.9.5-0 282) 1.9.4-0 283) 1.9.3-0 284) 1.9.2-0 285) 1.9.1-0 286) 1.9.0-0 287) 1.8.15-0 288) 1.8.14-0 289) 1.8.13-0 290) 1.8.12-0 291) 1.8.11-0 292) 1.8.10-0 293) 1.8.9-0 294) 1.8.8-0 295) 1.8.7-0 296) 1.8.6-0 297) 1.8.5-1 298) 1.8.5-0 299) 1.8.4-1 300) 1.8.4-0 301) 1.8.3-1 302) 1.8.3-0 303) 1.8.2-1 304) 1.8.2-0 305) 1.8.1-1 306) 1.8.1-0 307) 1.8.0-1 308) 1.8.0-0 309) 1.7.16-0 310) 1.7.15-0 311) 1.7.14-0 312) 1.7.11-1 313) 1.7.11-0 314) 1.7.10-1 315) 1.7.10-0 316) 1.7.9-1 317) 1.7.9-0 318) 1.7.8-2 319) 1.7.8-1 320) 1.7.7-2 321) 1.7.7-1 322) 1.7.6-2 323) 1.7.6-1 324) 1.7.5-1 325) 1.7.5-0 326) 1.7.4-1 327) 1.7.4-0 328) 1.7.3-2 329) 1.7.3-1 330) 1.7.2-1 331) 1.7.2-0 332) 1.7.1-1 333) 1.7.1-0 334) 1.7.0-1 335) 1.7.0-0 336) 1.6.13-1 337) 1.6.13-0 338) 1.6.12-1 339) 1.6.12-0 340) 1.6.11-1 341) 1.6.11-0 342) 1.6.10-1 343) 1.6.10-0 344) 1.6.9-1 345) 1.6.9-0 346) 1.6.8-1 347) 1.6.8-0 348) 1.6.7-1 349) 1.6.7-0 350) 1.6.6-1 351) 1.6.6-0 352) 1.6.5-1 353) 1.6.5-0 354) 1.6.4-1 355) 1.6.4-0 356) 1.6.3-1 357) 1.6.3-0 358) 1.6.2-1 359) 1.6.2-0 360) 1.6.1-1 361) 1.6.1-0 362) 1.6.0-1 363) 1.6.0-0 364) 1.5.4-1 365) 1.5.4-0 👉 请选择版本号 [1-365, 默认1]: 11 ✅ 已选择版本: Kubernetes v1.28.2 📦 下载Kubernetes组件... ⬇️ 下载: kubelet-1.28.2-0 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubelet-1.28.2-0.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubelet-1.28.2-0.el7.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubelet-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubelet-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubelet-1.28.2-0.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubelet-1.28.2-0.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubelet-1.28.2-0.el7.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubelet-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubelet-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubelet-1.28.2-0.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubelet-1.28.2-0.rpm 🔗 尝试: https://dl.k8s.io/release/kubelet-1.28.2-0.el7.rpm 🔗 尝试: https://dl.k8s.io/release/kubelet-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubelet-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubelet-1.28.2-0.x86_64.rpm 🔄 使用yumdownloader下载: kubelet Repository epel is listed more than once in the configuration 错误:未知仓库:'k8s-*' mv: '/opt/k8s-offline/packages/kubelet-1.28.2-0.rpm' 与'/opt/k8s-offline/packages/kubelet-1.28.2-0.rpm' 为同一文件 ✅ yumdownloader下载成功: kubelet-1.28.2-0.rpm ⬇️ 下载: kubeadm-1.28.2-0 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubeadm-1.28.2-0.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubeadm-1.28.2-0.el7.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubeadm-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubeadm-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubeadm-1.28.2-0.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubeadm-1.28.2-0.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubeadm-1.28.2-0.el7.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubeadm-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubeadm-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubeadm-1.28.2-0.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubeadm-1.28.2-0.rpm 🔗 尝试: https://dl.k8s.io/release/kubeadm-1.28.2-0.el7.rpm 🔗 尝试: https://dl.k8s.io/release/kubeadm-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubeadm-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubeadm-1.28.2-0.x86_64.rpm 🔄 使用yumdownloader下载: kubeadm Repository epel is listed more than once in the configuration 错误:未知仓库:'k8s-*' mv: '/opt/k8s-offline/packages/kubeadm-1.28.2-0.rpm' 与'/opt/k8s-offline/packages/kubeadm-1.28.2-0.rpm' 为同一文件 ✅ yumdownloader下载成功: kubeadm-1.28.2-0.rpm ⬇️ 下载: kubectl-1.28.2-0 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubectl-1.28.2-0.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubectl-1.28.2-0.el7.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubectl-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubectl-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/kubectl-1.28.2-0.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubectl-1.28.2-0.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubectl-1.28.2-0.el7.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubectl-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubectl-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/kubectl-1.28.2-0.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubectl-1.28.2-0.rpm 🔗 尝试: https://dl.k8s.io/release/kubectl-1.28.2-0.el7.rpm 🔗 尝试: https://dl.k8s.io/release/kubectl-1.28.2-0.el7.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubectl-1.28.2-0.el8.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/kubectl-1.28.2-0.x86_64.rpm 🔄 使用yumdownloader下载: kubectl Repository epel is listed more than once in the configuration 错误:未知仓库:'k8s-*' mv: '/opt/k8s-offline/packages/kubectl-1.28.2-0.rpm' 与'/opt/k8s-offline/packages/kubectl-1.28.2-0.rpm' 为同一文件 ✅ yumdownloader下载成功: kubectl-1.28.2-0.rpm ⬇️ 下载: cri-tools-1.26.0 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/cri-tools-1.26.0.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/cri-tools-1.26.0.el7.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/cri-tools-1.26.0.el7.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/cri-tools-1.26.0.el8.x86_64.rpm 🔗 尝试: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/cri-tools-1.26.0.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/cri-tools-1.26.0.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/cri-tools-1.26.0.el7.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/cri-tools-1.26.0.el7.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/cri-tools-1.26.0.el8.x86_64.rpm 🔗 尝试: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/cri-tools-1.26.0.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/cri-tools-1.26.0.rpm 🔗 尝试: https://dl.k8s.io/release/cri-tools-1.26.0.el7.rpm 🔗 尝试: https://dl.k8s.io/release/cri-tools-1.26.0.el7.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/cri-tools-1.26.0.el8.x86_64.rpm 🔗 尝试: https://dl.k8s.io/release/cri-tools-1.26.0.x86_64.rpm 🔄 使用yumdownloader下载: cri-tools Repository epel is listed more than once in the configuration 错误:未知仓库:'k8s-*' mv: '/opt/k8s-offline/packages/cri-tools-1.26.0.rpm' 与'/opt/k8s-offline/packages/cri-tools-1.26.0.rpm' 为同一文件 ✅ yumdownloader下载成功: cri-tools-1.26.0.rpm ✅ Kubernetes组件下载完成 🐳 下载Docker组件... 根据日志重新生成所有脚本

filetype

[2025-07-30 22:12:13] [INFO] ===== 开始下载Kubernetes离线资源 ===== [2025-07-30 22:12:13] [INFO] Kubernetes版本: v1.28.5 [2025-07-30 22:12:13] [INFO] 离线包目录: /opt/offline_packages [2025-07-30 22:12:13] [INFO] ===== 创建目录结构 ===== [2025-07-30 22:12:13] [SUCCESS] 目录创建完成: /opt/offline_packages [2025-07-30 22:12:13] [INFO] ===== 下载Kubernetes二进制文件 ===== [2025-07-30 22:12:13] [INFO] 下载: https://dl.k8s.io/release/v1.28.5/bin/linux/amd64/kubeadm #################################################################################################################################################################################################################### 100.0%#################################################################################################################################################################################################################### 100.0% [2025-07-30 22:16:46] [SUCCESS] 下载成功: kubeadm [2025-07-30 22:16:46] [INFO] 下载: https://dl.k8s.io/release/v1.28.5/bin/linux/amd64/kubelet #################################################################################################################################################################################################################### 100.0%#################################################################################################################################################################################################################### 100.0% [2025-07-30 22:20:51] [SUCCESS] 下载成功: kubelet [2025-07-30 22:20:51] [INFO] 下载: https://dl.k8s.io/release/v1.28.5/bin/linux/amd64/kubectl #################################################################################################################################################################################################################### 100.0%#################################################################################################################################################################################################################### 100.0% [2025-07-30 22:22:23] [SUCCESS] 下载成功: kubectl [2025-07-30 22:22:23] [INFO] ===== 下载容器镜像 ===== [2025-07-30 22:22:23] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/kube-apiserver:v1.28.5 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:24] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/kube-apiserver:v1.28.5 -> /opt/offline_packages/images/kube-apiserver-v1.28.5.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:25] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/kube-apiserver:v1.28.5 [2025-07-30 22:22:25] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.28.5 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:25] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.28.5 -> /opt/offline_packages/images/kube-controller-manager-v1.28.5.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:26] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.28.5 [2025-07-30 22:22:27] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/kube-scheduler:v1.28.5 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:28] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/kube-scheduler:v1.28.5 -> /opt/offline_packages/images/kube-scheduler-v1.28.5.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:29] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/kube-scheduler:v1.28.5 [2025-07-30 22:22:29] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/kube-proxy:v1.28.5 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:30] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/kube-proxy:v1.28.5 -> /opt/offline_packages/images/kube-proxy-v1.28.5.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:30] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/kube-proxy:v1.28.5 [2025-07-30 22:22:30] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/pause:3.9 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:31] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/pause:3.9 -> /opt/offline_packages/images/pause-3.9.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:31] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/pause:3.9 [2025-07-30 22:22:31] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/etcd:3.5.9-0 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:32] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/etcd:3.5.9-0 -> /opt/offline_packages/images/etcd-3.5.9-0.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:32] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/etcd:3.5.9-0 [2025-07-30 22:22:32] [INFO] 拉取镜像: registry.aliyuncs.com/google_containers/coredns:v1.10.1 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:33] [INFO] 保存镜像: registry.aliyuncs.com/google_containers/coredns:v1.10.1 -> /opt/offline_packages/images/coredns-v1.10.1.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:33] [ERROR] 镜像保存失败: registry.aliyuncs.com/google_containers/coredns:v1.10.1 [2025-07-30 22:22:33] [INFO] 拉取镜像: quay.io/coreos/flannel:v0.22.0 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:34] [INFO] 保存镜像: quay.io/coreos/flannel:v0.22.0 -> /opt/offline_packages/images/flannel-v0.22.0.tar Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [2025-07-30 22:22:35] [ERROR] 镜像保存失败: quay.io/coreos/flannel:v0.22.0 [2025-07-30 22:22:35] [INFO] ===== 下载系统优化工具 ===== [2025-07-30 22:22:35] [INFO] 下载: https://github.com/topaz2/cheat/releases/download/4.4.5/cheat-linux-amd64.gz #################################################################################################################################################################################################################### 100.0% [2025-07-30 22:22:36] [SUCCESS] 下载成功: cheat-linux-amd64.gz [2025-07-30 22:22:36] [INFO] 下载: https://github.com/aristocratos/btop/releases/download/v1.3.0/btop-x86_64-linux-musl.tbz -=O=- # # # # curl: (7) Failed to connect to github.com port 443: 拒绝连接 [2025-07-30 22:22:58] [ERROR] 下载失败: btop-x86_64-linux-musl.tbz [2025-07-30 22:22:58] [INFO] 下载: https://github.com/ClementTsang/bottom/releases/download/0.9.6/bottom_x86_64-unknown-linux-gnu.tar.gz -=O=- # # # # curl: (7) Failed to connect to github.com port 443: 拒绝连接 [2025-07-30 22:23:19] [ERROR] 下载失败: bottom_x86_64-unknown-linux-gnu.tar.gz [2025-07-30 22:23:19] [INFO] 下载: https://github.com/sharkdp/fd/releases/download/v8.7.1/fd-v8.7.1-x86_64-unknown-linux-gnu.tar.gz -=O=- # # # # curl: (7) Failed to connect to github.com port 443: 拒绝连接 [2025-07-30 22:23:40] [ERROR] 下载失败: fd-v8.7.1-x86_64-unknown-linux-gnu.tar.gz [2025-07-30 22:23:40] [INFO] 下载: https://github.com/sharkdp/bat/releases/download/v0.24.0/bat-v0.24.0-x86_64-unknown-linux-gnu.tar.gz -=O=- # # # # curl: (7) Failed to connect to github.com port 443: 拒绝连接 [2025-07-30 22:24:01] [ERROR] 下载失败: bat-v0.24.0-x86_64-unknown-linux-gnu.tar.gz [2025-07-30 22:24:01] [INFO] 下载: https://github.com/ogham/exa/releases/download/v0.10.1/exa-linux-x86_64-v0.10.1.zip -=O=- # # # # curl: (7) Failed to connect to github.com port 443: 拒绝连接 [2025-07-30 22:24:23] [ERROR] 下载失败: exa-linux-x86_64-v0.10.1.zip [2025-07-30 22:24:23] [INFO] ===== 生成部署脚本 ===== [2025-07-30 22:24:23] [SUCCESS] 系统优化脚本已生成 [2025-07-30 22:24:23] [SUCCESS] Kubernetes安装脚本已生成 [2025-07-30 22:24:23] [SUCCESS] ===== 下载完成! ===== [2025-07-30 22:24:23] [INFO] 1. 打包离线资源: sudo /opt/offline_packages/package_offline.sh [2025-07-30 22:24:23] [INFO] 2. 复制离线包到目标服务器 [2025-07-30 22:24:23] [INFO] 3. 在目标服务器解压: sudo tar -xzvf k8s-offline-pkg-*.tar.gz -C /opt [2025-07-30 22:24:23] [INFO] 4. 执行系统优化: sudo /opt/offline_packages/optimize_system.sh [2025-07-30 22:24:23] [INFO] 5. 安装Kubernetes: sudo /opt/offline_packages/install_k8s_offline.sh 根据错误、重新生成完整、有效、可用的下载脚本、离线部署脚本、服务器系统优化脚本。

filetype

[root@master ~]# kubectl describe node master Name: master Roles: master Labels: beta.kubernetes.io/arch=amd64 beta.kubernetes.io/os=linux kubernetes.io/arch=amd64 kubernetes.io/hostname=master kubernetes.io/os=linux node-role.kubernetes.io/master= Annotations: kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock node.alpha.kubernetes.io/ttl: 0 volumes.kubernetes.io/controller-managed-attach-detach: true CreationTimestamp: Mon, 30 Jun 2025 23:05:55 +0800 Taints: node-role.kubernetes.io/master:NoSchedule node.kubernetes.io/not-ready:NoSchedule Unschedulable: false Lease: HolderIdentity: master AcquireTime: <unset> RenewTime: Mon, 30 Jun 2025 23:52:29 +0800 Conditions: Type Status LastHeartbeatTime LastTransitionTime Reason Message ---- ------ ----------------- ------------------ ------ ------- MemoryPressure False Mon, 30 Jun 2025 23:48:30 +0800 Mon, 30 Jun 2025 23:05:51 +0800 KubeletHasSufficientMemory kubelet has sufficient memory available DiskPressure False Mon, 30 Jun 2025 23:48:30 +0800 Mon, 30 Jun 2025 23:05:51 +0800 KubeletHasNoDiskPressure kubelet has no disk pressure PIDPressure False Mon, 30 Jun 2025 23:48:30 +0800 Mon, 30 Jun 2025 23:05:51 +0800 KubeletHasSufficientPID kubelet has sufficient PID available Ready False Mon, 30 Jun 2025 23:48:30 +0800 Mon, 30 Jun 2025 23:05:51 +0800 KubeletNotReady runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized Addresses: InternalIP: 192.168.223.100 Hostname: master Capacity: cpu: 2 ephemeral-storage: 49250820Ki hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 1865308Ki pods: 110 Allocatable: cpu: 2 ephemeral-storage: 45389555637 hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 1762908Ki pods: 110 System Info: Machine ID: b1ddfdeaef1c4e31b63f6b3c2d5d770a System UUID: 6E934D56-42CE-BD4D-B0AF-20E4F34A34AB Boot ID: bad08499-a1b1-43db-b0e4-50f260e95011 Kernel Version: 3.10.0-862.el7.x86_64 OS Image: CentOS Linux 7 (Core) Operating System: linux Architecture: amd64 Container Runtime Version: docker://18.6.3 Kubelet Version: v1.17.4 Kube-Proxy Version: v1.17.4 PodCIDR: 10.244.0.0/24 PodCIDRs: 10.244.0.0/24 Non-terminated Pods: (7 in total) Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE --------- ---- ------------ ---------- --------------- ------------- --- kube-flannel kube-flannel-ds-dpzzq 100m (5%) 0 (0%) 50Mi (2%) 0 (0%) 7m7s kube-system etcd-master 0 (0%) 0 (0%) 0 (0%) 0 (0%) 46m kube-system kube-apiserver-master 250m (12%) 0 (0%) 0 (0%) 0 (0%) 46m kube-system kube-controller-manager-master 200m (10%) 0 (0%) 0 (0%) 0 (0%) 46m kube-system kube-flannel-ds-kbxf9 100m (5%) 100m (5%) 50Mi (2%) 50Mi (2%) 103s kube-system kube-proxy-jw6vd 0 (0%) 0 (0%) 0 (0%) 0 (0%) 46m kube-system kube-scheduler-master 100m (5%) 0 (0%) 0 (0%) 0 (0%) 46m Allocated resources: (Total limits may be over 100 percent, i.e., overcommitted.) Resource Requests Limits -------- -------- ------ cpu 750m (37%) 100m (5%) memory 100Mi (5%) 50Mi (2%) ephemeral-storage 0 (0%) 0 (0%) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Starting 46m kubelet, master Starting kubelet. Normal NodeHasSufficientMemory 46m kubelet, master Node master status is now: NodeHasSufficientMemory Normal NodeHasNoDiskPressure 46m kubelet, master Node master status is now: NodeHasNoDiskPressure Normal NodeHasSufficientPID 46m kubelet, master Node master status is now: NodeHasSufficientPID Normal NodeAllocatableEnforced 46m kubelet, master Updated Node Allocatable limit across pods Normal Starting 46m kube-proxy, master Starting kube-proxy.

火器营松老三
  • 粉丝: 36
上传资源 快速赚钱