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

生成器

相关推荐
a未来永远是个未知数1 天前
centos离线安装ntpcent
linux·运维·centos
爱编程的Zion1 天前
Jenkins 从 0 到 1 学习笔记
笔记·学习·jenkins
JavaDog程序狗2 天前
【指南】uni-app微信小程序多环境CI-CD完全指南
ci/cd·uni-app·jenkins
☆凡尘清心☆2 天前
CentOS Stream 9 源码编译搭建 Zabbix7.0.29 完整部署方案(部署成功)
linux·运维·centos
wsad05322 天前
CentOS 10 上使用 Docker Compose 部署 Discuz X5.0 论坛完整教程
linux·docker·centos·discuz
heimeiyingwang4 天前
【GitOps·入门篇】工具生态:ArgoCD、Flux、Jenkins X 对比选型
jenkins·flux·argocd·gitops
骇客野人4 天前
基于Nginx+Eureka+Apollo+Jenkins+SpringBoot Web系统分布式部署方案
nginx·eureka·jenkins
檀越剑指大厂5 天前
CentOS部署Landlord斗地主项目:源码编译并实现远程访问
linux·运维·centos
中才实用5 天前
Jenkins自动化部署
运维·自动化·jenkins
测试运维日常笔记6 天前
RHEL/CentOS 离线部署指南:配置本地 ISO 镜像作为 YUM 仓库
linux·运维·centos