Jenkins添加从节点

前提环境:

  • Jenkins需要安装以下两个插件
    SSH Build AgentsCredentials
  • 从节点需要安装java环境 (sudo yum install -y java-11-openjdk java-11-openjdk-devel)

ssh方式启动代理的话,有两种方式进行连接

  1. 账号密码方式进行连接
  2. 使用密钥方式进行连接

添加ssh连接凭证

选择以下两种方式的其中一种即可

  1. 账号密码方式进行连接
    img
    img
    img

  2. 使用密钥方式进行连接

在Jenkins主机且使用启动Jenkins的用户生成

$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ops/.ssh/id_rsa): 
Created directory '/home/ops/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/ops/.ssh/id_rsa.
Your public key has been saved in /home/ops/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:NQNYoBjA4Psr7i/rdaWBBAmW5INwlg1I3RvGejOAUfU ops@jenkins.ecloud.com
The key's randomart image is:
+---[RSA 2048]----+
|@O%=+..+o        |
|BBo=.*o  .       |
|.+..= oE  +      |
|  +..=   . o     |
| . ...o.S        |
|  .   +          |
|   o o           |
| o. o            |
|+==o             |
+----[SHA256]-----+

$ ssh-copy-id -i .ssh/id_rsa ops@192.168.32.163
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.32.163 (192.168.32.163)' can't be established.
ECDSA key fingerprint is SHA256:Ktn/Go2vYs7Tx/v0K+Y6/UVpL+34+O27uKjtKIOQeL4.
ECDSA key fingerprint is MD5:55:ec:35:6e:3a:4f:46:d3:a4:85:bd:ef:3b:9e:c2:c1.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ops@192.168.32.163's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'ops@192.168.32.163'"
and check to make sure that only the key(s) you wanted were added.

注意:需要用Jenkins启动用户来创建密钥文件及分发文件

img

img

添加从节点

系统管理 - 节点管理
img

新建节点

img
img

验证是否添加成功

img

posted @   jiaxzeng  阅读(262)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示