카테고리 없음

[jenkins] jenkins node 추가

thxxyj 2022. 10. 10. 16:26
728x90

1. Jenkins 신규 노드 추가

  • 노드명 입력 & Permanent Agent 선택
  • Remote root directory: /var/jenkins_home
  • Launch method: Launch agents via SSH 
  • Host: Docker container 이름 또는 IP
  • Credentials add
      SSH Username with private key 
       - ID : jenkins-rsa
       - Username : jenkins
       - private key 입력 (Jenkins master container의 /var/jenkins_home/.ssh/id_rsa 파일 복사하여 입력)
  • 고급 -> Port : 22  
  • Java Path: 
    root@76aa964556ca:/home/jenkins# which java
    /opt/java/openjdk/bin/java


2. ssh 연결 설정 (Jenkins master container 에서 실행)
  (아래 방식 중 하나를 선택하면 됨)
      $ ssh-keyscan -H {신규 노드 IP} >> /var/jenkins_home/.ssh/known_hosts
      $ ssh-keyscan -H {신규 노드 설정한 컨테이너 이름} >> /var/jenkins_home/.ssh/known_hosts
      $ ssh-keyscan -p {Port번호} {IP} >> /var/jenkins_home/.ssh/known_hosts

      root@c68dac4d9498:/# ssh-keyscan -H slave1 >> /var/jenkins_home/.ssh/known_hosts
      # slave1:22 SSH-2.0-OpenSSH_8.4p1 Debian-5
      # slave1:22 SSH-2.0-OpenSSH_8.4p1 Debian-5
      # slave1:22 SSH-2.0-OpenSSH_8.4p1 Debian-5
      # slave1:22 SSH-2.0-OpenSSH_8.4p1 Debian-5
      # slave1:22 SSH-2.0-OpenSSH_8.4p1 Debian-5

 


3. node 연결 permission error 발생 하면, Remote root directory 권한 777 변경 
  chmod -R 777 /var/jenkins_home

 

* Jenkins 관리 > Security > Configure Global Security
  TCP port for inbound agents를 Random으로 설정
  worker node 실행을 위한 JNLP agent의 TCP/IP port 사용에 대한 설정을 Random으로 선택
  (Random 하게 port를 선택하여 에이전트 실행 시 접속 충돌을 방지하기 위해서)  

728x90