1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Jenkins slave nodeの追加

Posted at

#事前準備
masterノード: 1台のAWS EC2インスタンスを作成しておく。
slaveノード: 1台のAWS EC2インスタンスを作成しておく。

slaveノードの配置

sudo yum update
sudo amazon-linux-extras install java-openjdk11
java
sudo useradd -d /var/lib/jenkins jenkins
sudo grep jenkins /etc/passwd
sudo su - jenkins
cd /var/lib/jenkins
mkdir .ssh
mkdir work
cp /home/ec2-user/.ssh/authorized_keys /var/lib/jenkins/.ssh/
chmod 600 /var/lib/jenkins/.ssh/authorized_keys
chmod 700 /var/lib/jenkins/.ssh

Jenkins web uiでslaveノードの追加と接続

<1>masterノードから、slaveノードにsshで接続する用credentialの作成
username: jenkins
ssh private key: kp1.pemの中身をコピーし、入力し、保存する

Screen Shot 2021-11-15 at 19.09.09.png

<2>slaveノードを追加する
Screen Shot 2021-11-15 at 19.10.10.png

Screen Shot 2021-11-15 at 19.10.30.png

Screen Shot 2021-11-15 at 19.17.01.png

<3>slaveノードを確認する。

[ec2-user@ip-172-31-40-72 ~]$ sudo ls -la /var/lib/jenkins
total 20
drwx------  5 jenkins jenkins  121 Nov 15 03:16 .
drwxr-xr-x 31 root    root    4096 Nov 15 02:47 ..
-rw-------  1 jenkins jenkins  194 Nov 15 03:10 .bash_history
-rw-r--r--  1 jenkins jenkins   18 Jul 15  2020 .bash_logout
-rw-r--r--  1 jenkins jenkins  193 Jul 15  2020 .bash_profile
-rw-r--r--  1 jenkins jenkins  231 Jul 15  2020 .bashrc
drwxrwxr-x  3 jenkins jenkins   17 Nov 15 03:16 .cache
drwx------  2 jenkins jenkins   29 Nov 15 02:51 .ssh
drwxrwxr-x  3 jenkins jenkins   42 Nov 15 03:16 work
[ec2-user@ip-172-31-40-72 ~]$ sudo ls -la /var/lib/jenkins/.ssh
total 4
drwx------ 2 jenkins jenkins  29 Nov 15 02:51 .
drwx------ 5 jenkins jenkins 121 Nov 15 03:16 ..
-rw------- 1 jenkins jenkins 385 Nov 15 02:51 authorized_keys
[ec2-user@ip-172-31-40-72 ~]$ sudo ls -la /var/lib/jenkins/work
total 1476
drwxrwxr-x 3 jenkins jenkins      42 Nov 15 03:16 .
drwx------ 5 jenkins jenkins     121 Nov 15 03:16 ..
drwxrwxr-x 4 jenkins jenkins      34 Nov 15 03:16 remoting
-rw-rw-r-- 1 jenkins jenkins 1507813 Nov 15 03:16 remoting.jar
[ec2-user@ip-172-31-40-72 ~]$ 
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?