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

生成器

相关推荐
脑子不好的小菜鸟40 分钟前
用vscode连接远端ubuntu无法git push,vscode无法连接centos
git·vscode·ubuntu·centos
可乐大数据4 小时前
Docker安装(基于云服务器ECS实例 CentOS 7.9系统)
服务器·docker·centos
做运维的阿瑞8 小时前
CentOS 7 停止维护后 YUM 源配置速查手册
linux·运维·centos
草莓熊Lotso8 小时前
Linux 权限管理进阶:从 umask 到粘滞位的深度解析
linux·运维·服务器·人工智能·ubuntu·centos·unix
i_am_a_div_日积月累_18 小时前
jenkins打包报错
运维·rust·jenkins·jenkins打包报错
一个处女座的暖男程序猿18 小时前
2G2核服务器安装ES
服务器·elasticsearch·jenkins
Thexhy18 小时前
在 CentOS 7 的 Linux 系统中配置 NFS
linux·运维·学习·centos
一个处女座的暖男程序猿1 天前
2G2核服务器安装ES 7X版本
服务器·elasticsearch·jenkins
程序员陆通1 天前
CentOS/AlmaLinux 9 中 SSH 服务启动失败:OpenSSL 版本不匹配解决
linux·centos·ssh
李少兄1 天前
解决 CentOS 8 报错:Failed to download metadata for repo ‘BaseOS‘
linux·运维·centos