背景:使用 docker 搭了 jenkins 服务,需要添加 node 测试。jenkins docker 镜像 jenkins/jenkins:2.152
1 由于Jenkins是Java程序,添加的SLAVE客户端服务器必须安装Java JDK环境
2 jenkins 登陆后, manage jenkins --> manage nodes --> new node --> node name: name001(你需要添加的nodes名称,随意) , permanent agent: yes --> remote root diretory: /root , usage: use the node as much as possible, lauch method: launch agent agents via ssh, host: 192.168.1.3(你需要添加的nodes ip), credentials: add: jenkins:{ kind: username with password, username: root (你需要添加的nodes 的用户名), password: 321321(你需要添加的nodes 的密码)}, advanced --> javapath: /user/bin/java
问题: [SSH] WARNING: No entry currently exists in the Known Hosts file for this host
原因: jenkins 的 knowhosts 文件中没有 192.168.1.3(你需要添加的nodes ip)的信息,添加进去
解决方法:
进入容器,ssh 登陆 192.168.1.3,得到 known_hsots 信息
将 known_hosts 信息复制到 jenkins 容器的 /var/jenkins_home/.ssh/known_hosts 文件中
[root@myjenkins .ssh]# docker exec -it jenkins sh
#ssh 192.168.1.3
#cat /root/.ssh/known_hosts
#cat /root/.ssh/known_hosts >> /var/jenkins_home/.ssh/known_hosts
参考:
https://www.cnblogs.com/jsonhc/p/7372359.html
|