搭建jenkins
搭建NFS
创建PV
创建PVC
创建Deployment
创建SVC
Jenkins启动过程中遇到的问题
- 日志提示文件无权限
touch:cannottouch‘/var/jenkins_home/copy_reference_file.log’:Permissiondenied
Cannotwriteto/var/jenkins_home/copy_reference_file.log.Wrongvolumepermissions?
解决方式: 查看jenkins 容器的用户名及用户id
docker run -ti --rm --entrypoint="/bin/bash" jenkins -c "whoami && id"
jenkins
uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
查看目录权限
docker run -ti --rm --entrypoint="/bin/bash" jenkins -c "ls -la /var/jenkins_home"
total 20
drwxr-xr-x 2 jenkins jenkins 4096 Nov 22 07:43 .
drwxr-xr-x 26 root root 4096 Nov 8 21:55 ..
-rw-r--r-- 1 jenkins jenkins 220 Nov 12 2014 .bash_logout
-rw-r--r-- 1 jenkins jenkins 3515 Nov 12 2014 .bashrc
-rw-r--r-- 1 jenkins jenkins 675 Nov 12 2014 .profile
查看本地授权
root@debian1:/mydata/jenkins_home
总用量 4
drxr-xr-x 16 root root 4096 6月 28 07:35 jenkins
更改授权
root@debian1:/mydata/jenkins_home
再次启动
root@debian1:/mydata/jenkins_home
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8c221f324db2 jenkins "/bin/tini -- /usr..." About an hour ago Up About an hour 50000/tcp, 0.0.0.0:8000->8080/tcp myjenkins
a619127a44fa 31758056d8e2 "/bin/sh -c 'addgr..." 3 hours ago Exited (137) About an hour ago naughty_ritchie
root@debian1:/mydata/jenkins_home
访问测试 安装jenkins
浏览器打开http://127.0.0.1:8000
登陆密码在/var/jenkins_home/secrets/initialAdminPassword查找
插件安装,这里选择了默认的Install plugins the Jenkins community finds most useful.安装。
懂的同学可以选择自己选择插件安装
1.权限管理
插件:Role-based Authorization Strategy 开启 Role-based Authorization 角色管理 凭据管理
|