当前位置:网站首页>SSH method 2 for adding node nodes in Jenkins

SSH method 2 for adding node nodes in Jenkins

2022-06-22 22:55:00 Non famous operation and maintenance

install SSH plug-in unit

Jenkins- Plug-in management - Optional plug-ins - Search for SSH Agent

Configure enable SSH Server

Jenkins- System management - Global security configuration , hold SSH Server Set to enable ( The default is disable )

New node

The first way (SSH Key connection ):

1.Jenkins Host generation SSH secret key

[[email protected] ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:oI7S4uwjskL1wGBt04Xq3F2huICMKSZ8jBTfwiROlNk [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|.=*.. o.         |
|o*=E.o   .       |
|*oB+o.o . .      |
|=* O.o o .       |
|+ = * o S        |
| o = + .         |
|+ o .            |
|*+               |
|*=.              |
+----[SHA256]-----+

2. send out Jenkins Host public key to remote host

[[email protected] ~]# ssh-copy-id 192.168.1.20

3. test Jenkins The host connects to the remote host without secret

[[email protected] ~]# ssh [email protected]
Last login: Fri Mar  4 10:44:53 2022 from k8s-master
[[email protected] ~]#

4. add to Jenkins host SSH Private key key For credentials

[[email protected] ~]# cat /root/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA0le59pH7mp+XHxmkoEbX8SyXcZ+dmcyhrS1HbqtfnWVoSqai
MrQijlIDv66bFDg9VnbFUKiXrcbzC+wVh8zuuy4Zl9OyvUEOC/YSHwaBvqMwPqgw
nipCRoNNq3MQMBr7T6r7SWA0CCP2IPCl+q0W/HHI5LRk8FT7rGH/hdufwYn8rJxM
B7jntBXMKZJzIQRMyVkZ0vlAla/2/t33dQVRLKNF8//G3wEKQL1yGMgmCXtAj/rn
M96T4qIq4DpkELUFR52ql5SjSFZ3MLQ5Weyx81leLIJH5ikJ6N6pH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of5ptr0VCis9vqLITJoc9/n5GyuovwEAMcQkdWtl/21DEyWb74Lds
Mw+JPQKBgQCiKGvd+YXzPgh3BJoguaMAIrcrlr0iGAEU5y2qi4xgqfyp4Wcb+RHx
LAF7Uz2aT5oj4GP7HVBN7E2OyBe9TjOATnRRb+lSTKNMYYV20av5LaahtlN5URYu
JC7glE/aMXR60Fx4E0iajzZpDKFyQSfc1TqReBQQF+qR0c5QeQSbRw==
-----END RSA PRIVATE KEY-----

5. Add slave node

Add node page explanation :

  • name : Customize a node name
  • Number of actuators : Can be executed at the same time job Number of threads , Just write a number
  • Teleworking program : The host machine Workspace Catalog
  • label : Customize , Facilitate later identification
  • usage : Use this node as much as possible
  • Starting mode :Launch agent agents via SSH
  • host : Enter the host to be remote IP Address
  • Credentials: take Jenkins Locally generated SSH The public key of the key is sent to the host to be remote , And add Jenkins The private key of the host key Remote connection for credentials
  • Host Key Verification Strategy: That's the choice Known hosts file Verification Strategy

The second way :(ROOT Account secret connection )

1. Add the name of the remote host ROOT The account and password are credentials

2. Add slave node

Add node page explanation :

  • name : Customize a node name
  • Number of actuators : Can be executed at the same time job Number of threads , Just write a number
  • Teleworking program : The host machine Workspace Catalog
  • label : Customize , Facilitate later identification
  • usage : Use this node as much as possible
  • Starting mode :Launch agent agents via SSH
  • host : Enter the host to be remote IP Address
  • Credentials: Add the host to be remote ROOT Credentials for account and password
  • Host Key Verification Strategy: That's the choice Non verifying Verifcation Stragegy
原网站

版权声明
本文为[Non famous operation and maintenance]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221638317913.html