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

生成器

相关推荐
weixin_3077791318 小时前
Linux下Jenkins数据故障的系统化排查Shell脚本
linux·运维·服务器·jenkins
AOwhisky2 天前
Linux(CentOS)系统管理入门笔记(第九期)——文件权限进阶:SUIDSGIDSticky、ACL 与 chattr
linux·运维·笔记·centos·云计算·文件权限管理
qetfw3 天前
CentOS 7 搭建 MariaDB 数据库服务
linux·数据库·centos·mariadb
海兰4 天前
【Elasticsearch】工作流自动化评估
elasticsearch·自动化·jenkins
qetfw4 天前
CentOS 7 搭建 LVS + Keepalived 高可用负载均衡
linux·centos·负载均衡·lvs
雪花凌落的盛夏4 天前
CentOS系列Linux安装NVIDIA显卡驱动,安装CUDA工具用来跑AI
linux·人工智能·centos
tianyuanwo4 天前
深入掌握 java -jar 命令:从基础到 Jenkins Agent 实战
java·jenkins·jar
潘正翔4 天前
docker核心概念
linux·运维·服务器·docker·容器·centos·运维开发
qetfw4 天前
CentOS 7 搭建 LDAP 目录服务
linux·运维·centos
这个需求做不了5 天前
Jenkins自动化构建与CI/CD流水线,并配置GitLab
java·ci/cd·自动化·gitlab·jenkins