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

生成器

相关推荐
蓝色土耳其love3 分钟前
centos 7.9 安装单机版k8s
linux·运维·服务器·kubernetes·centos
洛克大航海31 分钟前
CentOS8无法使用sudo提权
linux·centos·无法使用 sudo 提权
sulikey17 小时前
从实验出发深入理解Linux目录权限:r、w、x分别控制什么?能否进入目录到底由谁决定?
linux·运维·服务器·ubuntu·centos
久曲健的测试窝19 小时前
Jenkins Share Library教程 —— 开发入门
运维·servlet·jenkins
xxxxxxllllllshi1 天前
Java中Elasticsearch完全指南:从零基础到实战应用
java·开发语言·elasticsearch·面试·职场和发展·jenkins
迷路爸爸1801 天前
源码编译安装最新 tmux 教程(含 Debian/Ubuntu/CentOS/Arch/macOS 等系统)
linux·ubuntu·macos·centos·debian·tmux·archlinux
BTU_YC1 天前
CentOS 7 虚拟IP配置指南:使用传统network-scripts实现高可用
linux·tcp/ip·centos
序属秋秋秋1 天前
《Linux系统编程之入门基础》【Linux基础 理论+命令】(上)
linux·运维·服务器·ubuntu·centos·命令模式
sulikey2 天前
【Linux权限机制深入理解】为何没有目录写权限仍能修改文件权限?
linux·运维·笔记·ubuntu·centos
别或许2 天前
在centos系统下,安装MYSQL
linux·mysql·centos