How to configure a pod template with a Freestyle Job

Article ID:360028491871
2 minute readKnowledge base

Issue

I configured a pod template, but I am under the impression my Freestyle job is not running in the template.

Resolution

When you configure a pod template for a freestyle job, the important thing to understand is that you cannot choose the container that your steps will run in. This is one of the major differences with the Pipelines.

The build steps of a Freestyle job will always run in the jnlp container.

Therefore, you need to override the jnlp container in the pod template.

The important thing is that this jnlp container should have a jdk8 available, as the agent.jar (remoting), will run in this container. The pod template should have the following field setup:

  • Pod Template > Container Template > Name: jnlp

  • Pod Template > Container Template > Docker image: any image with a jdk8 in the $PATH

  • Pod Template > Container Template > Command to run: you need to either set this field empty to inherit the default configuration, or use /bin/sh

  • Pod Template > Container Template > Arguments to pass to the command: you need to either set this field empty to inherit the default configuration, or use /var/jenkins_config/jenkins-agent

    As of CloudBees CI version 2.462.3.3, the jenkins-agent ConfigMap has been deprecated. The jenkins-agent ConfigMap will be removed from the Helm chart in late 2025. For migration information, refer to Migrate from jenkins-agent ConfigMap to agent-injection.
  • Pod Template > Volumes: the default configuration should inject for you the Config Map that the agent needs to get started. On older installation, you should manually add a Config Map Volume with Config Map name: jenkins-agent and Mount path: /var/jenkins_config.