当前位置:网站首页>helm安装jenkins(官方)
helm安装jenkins(官方)
2022-04-21 21:33:00 【wnfee】
文章目录
1. 搜索
# 添加repo
helm repo add jenkins https://charts.jenkins.io
helm repo update
[root@master helm]# helm search repo jenkins/jenkins
NAME CHART VERSION APP VERSION DESCRIPTION
jenkins/jenkins 3.11.10 2.332.2 Jenkins - Build great things at any scale! The ...
2. my-values.yaml
cat <<EOF> my-values.yaml
controller:
image: "registry.cn-shanghai.aliyuncs.com/wanfei/jenkins"
# tag: "2.332.2-jdk11"
tagLabel: jdk11
imagePullPolicy: "IfNotPresent"
adminUser: "admin"
adminPassword: "www19930327"
ingress:
enabled: true
apiVersion: "networking.k8s.io/v1"
ingressClassName: nginx
hostName: jenkins.tophant.wang
persistence:
enabled: true
storageClass: "nfs-storage"
size: "2Gi"
EOF
3. 部署
helm install jenkins jenkins/jenkins --version 3.11.10 -f my-values.yaml
helm install jenkins -f my-values.yaml .
# 卸载
helm uninstall jenkins
jenkins repo下载速度非常慢
4. 验证部署
[root@master jenkins]# kubectl get pods | grep jenkins
jenkins-0 2/2 Running 0 47m
[root@master jenkins]# kubectl get svc | grep jenkins
jenkins ClusterIP 10.106.137.1 <none> 8080/TCP 49m
jenkins-agent ClusterIP 10.101.182.60 <none> 50000/TCP 49m
本地添加hosts
192.168.4.27 jenkins.tophant.wang
访问 http://jenkins.tophant.wang
如果忘记了密码,可以查看密码
kubectl exec --namespace default -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/chart-admin-password && echo
输入账号密码 admin/www19930327

5. 安装中文插件
搜索Localization: Chinese (Simplified),点第二个

安装后重启(勾选Restart)

6 添加gitee凭据
等会儿测试需要从码云(
gitee)下载代码
6.1 安装gitee插件
搜索gitee,点第二个

6.2 配置gitee私钥
点击【系统管理】-【管理凭据】,点击如下图【Jenkins】

点击【全局凭据】

点击【增加凭据】

此时去复制gitee私钥,登录gitee后,点击头像,然后点击【设置】,点击【私人令牌】,然后点击【生成新的令牌】

填写令牌描述,然后根据实际需求选择权限,点击提交

输入gitee密码验证

回到打开的新增凭据页面,选择【Gitee API 令牌】,然后将上个步骤拷贝的私钥粘贴到此处,然后增加描述内容,点击确定即可

此时Gitee私钥就添加完成了

6.3 Gitee插件配置
点击【系统管理】-【系统配置】
找到Gitee配置,链接名自定义,比如Gitee,域名填写 https://gitee.com,证书令牌选择步骤1中增加的凭据,点开【高级】,勾选忽略SSL检查,然后点击【测试连接】,如下显示成功即OK

如果
测试连接一直报错,需要安装jersey 2 API插件,然后就可以了
参考 https://blog.csdn.net/m0_65787443/article/details/123031292
6.4 添加gitee账号凭据

6.5 创建一个从gitee代码仓拉取代码任务

然后点击立即构建
可以看到创建了一个Agent default-0k406去执行任务


7. 流水线部署
7.1 配置集群
kubernetes插件默认安装了
系统管理 -> 节点管理

点击Configure Clouds,发现默认都配置好了,点击连接测试成功

查看默认的标签jenkins-jenkins-agent

7.2 流水线任务

流水线脚本
node('jenkins-jenkins-agent'){
stage("clone 代码"){
echo "代码 clone"
}
stage("代码构建"){
echo "代码构建"
}
stage("代码测试"){
echo "代码测试"
}
stage("代码部署"){
echo "代码部署"
}
}

8. Jenkinsfiel流水线部署
创建protal-dev流水线任务

配置gitee项目,项目里面必须要有Jenkinsfile文件

项目结构如下

script:里面包含docker构建镜像push镜像脚本和chart模板Jenkinsfile:流水线过程
因为上面引用了maven-pvc,所以需要创建,用来存储maven jar包
cat <<EOF> maven-pvc.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: maven-pv
spec:
capacity:
storage: 4Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Delete
nfs:
server: 192.168.4.27
path: /nfsdata
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: maven-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 4Gi
EOF
kubectl apply -f maven-pvc.yaml
当前
StorageClass不能有默认的,否则会自动创建pv,不使用上面的pv
点击立即构建

创建了一个Pod: kubernetes default/slave-26c42db4-79ad-49ab-89c8-e7cdf41b501a-z5frp-0vds3执行当前部署,部署完成之后自动删除

当前jar包存储路径
[root@master jenkins]# ls /nfsdata/repository/
com commons-io io org
版权声明
本文为[wnfee]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_38983728/article/details/124300844
边栏推荐
- 尿素期货怎么做才安全?尿素期货套期保值会有什么好处?
- 或许你不知道的12条SQL技巧
- Others - MYCAT realizes sub database and sub table
- [spark] (task5) fundamentals of sparkml (classification | clustering model)
- 数据库小练习
- Yuanxin technology seeks to be listed again: the amount of loss soars, and the R & D expense rate is less than 2%. How to break through?
- Construction of cloud computing platform based on openstack
- Architecture document of student management system
- Qianxin Winter Olympics "zero accident" terminal security sharing meeting: 6641 attacks were successfully solved
- Reading breaks ten thousand "volumes": National Reading insight 2022
猜你喜欢

Neural network learning record 57 -- introduction, advantages and disadvantages of various activation functions

841. String hash (string hash template)

Back to basics, multi-party security computing should return to the original consideration of "security"

Flutter plug-in third-party library, some interview suggestions for Android programmers

一加连发两款耳机产品:充电10分钟 听歌20小时

After the virtual machine is shut down, restart Linux and restart Oracle monitoring inside

产品增长框架:从 Web2 到 Web3

清洁机器人--红外下视传感器,检测是否存在地面距离突变的情形

Neural network learning small record 56 -- the principle and function of batch normalization layer

危机四伏,卡士酸奶的高端人设还立得住吗?
随机推荐
Others - the ultimate design scheme of sub database and sub table
移动Web开发之rem实际开发适配方案
Gan remake 2, which seems to be fun -- keras built srgan platform to improve the super-resolution of pictures
Workflow report setting customization development
[common English words]
Product growth framework: from web2 to Web3
MySQL多表查询小练习
模块三作业 架构设计文档
Neural network learning small record 56 -- the principle and function of batch normalization layer
841. String hash (string hash template)
Flutter plug-in third-party library, some interview suggestions for Android programmers
Yuanxin technology seeks to be listed again: the amount of loss soars, and the R & D expense rate is less than 2%. How to break through?
Other - use of Supervisor
AI + great health is the right way to open the super robot?
Others - Introduction to Devops
还清90万安居贷才能拿到离职证明?腾讯回应:与实际情况不符
Reflex WMS study experience shelf principle
135, 137, 138, 139 and 445 port explanation and closing method
憨批的语义分割重制版6——Pytorch 搭建自己的Unet语义分割平台
(亲测有效)Oracle在linux下命令行无法使用退格键退格,无法使用上下键切换历史命令的解决办法,会出现乱码