Which statement correctly describes the difference between SSH and JNLP agent connection methods in Jenkins?
Think about who starts the connection in each method.
SSH agents connect by Jenkins initiating an SSH session to the agent machine, requiring Jenkins to access the agent's SSH port. JNLP agents run a Java process on the agent machine that connects back to Jenkins, so the agent initiates the connection.
What is the expected output when running the following command on the agent machine to start a JNLP agent?
java -jar agent.jar -jnlpUrl http://jenkins.example.com/computer/agent1/slave-agent.jnlp -secret 1234567890abcdefJNLP agents connect using Java and a secret key.
The command runs the Java agent jar with the JNLP URL and secret key. It connects to Jenkins and starts the agent process, showing connection info messages.
Which SSH configuration snippet correctly sets up a Jenkins agent to connect via SSH with a private key located at /home/jenkins/.ssh/id_rsa?
Check the user, key file path, and SSH options for security.
Option A correctly uses the Jenkins user, the correct private key path, and disables strict host key checking for easier connection. Option A incorrectly enables password authentication which is not needed. Option A uses root user and wrong key path. Option A sets a wrong port for SSH.
A Jenkins SSH agent fails to connect with the error: Permission denied (publickey). Which is the most likely cause?
Think about SSH authentication errors.
Permission denied (publickey) means SSH authentication failed because the private key Jenkins uses does not match any authorized public key on the agent machine. Firewall blocking port 8080 or JNLP secret key issues relate to JNLP agents, not SSH. The Java agent jar is unrelated to SSH connection.
For a Jenkins setup with many dynamic cloud agents behind firewalls, which agent connection method is best practice and why?
Consider firewall and network restrictions for cloud agents.
JNLP agents connect by the agent initiating the connection to Jenkins, which works well behind firewalls and NATs common in cloud environments. SSH agents require Jenkins to connect inbound to agents, which is often blocked. Thus, JNLP is preferred for dynamic cloud agents.