jenkins通过流水线自动部署项目(k8s部署)

参考:https://www.cnblogs.com/rb2010/p/16195443.html

docker 拉取镜像到本地:

powershell 复制代码
docker pull docker.io/jenkins/jenkins:2.164

配置卷挂载:使用nfs

参考:https://www.kuboard.cn/learning/k8s-intermediate/persistent/nfs.html#在客户端测试nfs

配置NFS服务器

安装nfs

powershell 复制代码
yum install -y rpcbind nfs-utils

编辑文件:

powershell 复制代码
vim /etc/exports

写入:

xml 复制代码
/root/nfs_root/ *(insecure,rw,sync,no_root_squash)

执行以下命令,启动 nfs 服务

powershell 复制代码
# 创建共享目录,如果要使用自己的目录,请替换本文档中所有的 /root/nfs_root/
mkdir /root/nfs_root

systemctl enable rpcbind
systemctl enable nfs-server

systemctl start rpcbind
systemctl start nfs-server
exportfs -r

检查配置是否生效

powershell 复制代码
exportfs

在客户端测试nfs

powershell 复制代码
yum install -y nfs-utils

执行以下命令检查 nfs 服务器端是否有设置共享目录

xml 复制代码
# showmount -e $(nfs服务器的IP)
showmount -e 172.17.216.82
# 输出结果如下所示
Export list for 172.17.216.82:
/root/nfs_root *

输出结果如下所示

/root/nfs_root /root/nfs_root

注意卷挂载这里要讲nfs服务器上准备的文件权限设为可使用的才行!

powershell 复制代码
chmod 777 jenkins

要能安装插件,还需要配置dns

生成器

相关推荐
海兰3 小时前
Elasticsearch 9.3.0 日志数据源配置
大数据·elasticsearch·jenkins
海兰5 小时前
elasticsearch学习之基本概念-混合搜索
学习·elasticsearch·jenkins
mqffc21 小时前
Linux(CentOS)安装 MySQL
linux·mysql·centos
何中应1 天前
使用Jenkins部署前端项目(Vue)
前端·vue.js·jenkins
何中应1 天前
使用Jenkins部署后端项目(Maven)
运维·ci/cd·jenkins
礼拜天没时间.1 天前
Docker与Harbor迁移实战:从入门到生产级完整指南
linux·运维·docker·容器·架构·centos
何中应1 天前
Jenkins如何导入/导出插件
运维·ci/cd·jenkins
我的xiaodoujiao1 天前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 49--CI/CD-开始探索使用Jenkins
python·学习·测试工具·ci/cd·jenkins·pytest
玄〤1 天前
Elasticsearch进阶实战:JavaRestClient操作索引与文档及海量数据批处理指南(黑马商城)(黑马微服务课day13)
elasticsearch·搜索引擎·微服务·jenkins
wsad05322 天前
Xshell 连接 CentOS 7 Minimal 完整配置指南
linux·运维·centos