# Readiness probe for additional container in PodTemplate

**URL:** <https://community.jenkins.io/t/readiness-probe-for-additional-container-in-podtemplate/8360>\
**Category:** Using Jenkins\
**Tags:** kubernetes\
**Created:** [July 7, 2023, 4:34pm UTC](https://community.jenkins.io/t/readiness-probe-for-additional-container-in-podtemplate/8360 "2023-07-07T16:34:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![max.nitze](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@max.nitze](https://community.jenkins.io/u/max.nitze)\
**Post date:** [July 7, 2023, 4:34pm UTC](https://community.jenkins.io/t/readiness-probe-for-additional-container-in-podtemplate/8360/1 "2023-07-07T16:34:24Z")

</div>

How can I add a readiness probe to an extra container ina Pod template?

I have a Jenkins running in Kubernetes. My agents come with an additional Docker-in-Docker (dind) container. I noticed, that jobs, that immediately run some Docker commands sometimes (most of the time) fail. The reason seems to be, that the Docker daemon in the DIND container is not yet started properly. I tested this by adding a waiting period to one of the jobs. After I did that, they ran successfully.

So what I want to do now is delay the readiness of the agent pod until the Docker daemon is started up properly. For that I need a readiness (or startup) probe. on that additional container.

Here’s the config of my agents in the Helm chart for reference:

```yaml
agent:
  image: my-custom-jnlp-image
  tag: 1.2.3
  customJenkinsLabels: worker
  imagePullSecretName: registry-credentials
  runAsUser: jenkins
  runAsGroup: jenkins
  resources:
    # ...
  showRawYaml: false
  workspaceVolume:
    type: EmptyDir
    memory: false
  envVars:
    - name: DOCKER_HOST
      value: tcp://localhost:2375
  nodeSelector: # schedule agents only on labeled nodes
    jenkins-agent: "true"
  podName: jenkins-worker
  # tolerate nodes with taint dedicated=jenkins:NoSchedule or dedicated=jenkins:PreferNoSchedule
  yamlTemplate: |-
    apiVersion: v1
    kind: Pod
    spec:
      tolerations:
      - key: "dedicated"
        operator: "Equal"
        value: "jenkins"
  additionalContainers:
    - sideContainerName: dind
      image: my-custom-dind-image
      tag: 3.2.1
      privileged: true
      resources:
        # ...

```

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![max.nitze](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@max.nitze](https://community.jenkins.io/u/max.nitze)\
**Post date:** [July 11, 2023, 9:16am UTC](https://community.jenkins.io/t/readiness-probe-for-additional-container-in-podtemplate/8360/2 "2023-07-11T09:16:06Z")

</div>

I found liveness probes in the UI, but there is currently no way to configure this from the official Helm chart. I created a PR to add this. Chart version is 4.4.0.

> <https://github.com/jenkinsci/helm-charts/pull/893>
>
> \### What does this PR do?
> 
> Pod templates for agents support liveness probes:
> …
> !\[Clouds - Manage Jenkins\](https://github.com/jenkinsci/helm-charts/assets/5288395/d720d2da-2713-4fc9-aa55-d68d5e03f9d1)
> 
> But the chart does not. This PR adds the possibility to configure liveness probes on all containers, main and sidecar, of your agent pods.
> 
> \`\`\`\[tasklist\]
> \### Submitter checklist
> \- \[X\] I bumped the "version" key in \`./charts/jenkins/Chart.yml\`.
> \- \[X\] I added a new changelog entry to \`./charts/jenkins/CHANGELOG.md\`.
> \- \[X\] I followed the \[technical requirements\](https://github.com/jenkinsci/helm-charts/blob/main/CONTRIBUTING.md#technical-requirements).
> \`\`\`
> 
> \### Special notes for your reviewer
> 
> To get the tests working, I had to update a lot of IDs in the \`jcasc-config-test.yaml\` file. Is this intended? Is there any way to make this easier than looking at the failing tests and copying the ids to the tests file (25 times)?

---

<div class="post-metadata">

**Author:** ![max.nitze](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@max.nitze](https://community.jenkins.io/u/max.nitze)\
**Post date:** [July 13, 2023, 9:44am UTC](https://community.jenkins.io/t/readiness-probe-for-additional-container-in-podtemplate/8360/3 "2023-07-13T09:44:48Z")

</div>

Unfortunately having a liveness probe does not do the trick ☹
