By default, all containers within a Kubernetes Pod share the same filesystem. In this tutorial, we’ll demonstrate how to create a file in an Ubuntu container and then read it from a Node.js container within the same Pod using a Jenkins pipeline.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Containers in the same Pod share volumes and file systems, allowing seamless data exchange without additional configuration.
Jenkins Pipeline Configuration
Paste the following pipeline definition into your Jenkinsfile to set up two containers—ubuntu-container and node-container—in a single Pod:
Pipeline in Action
Once you commit and run this pipeline, Jenkins will create the Pod and execute both stages. The Ubuntu container writesubuntu-$BUILD_ID.txt, and the Node.js container reads it immediately afterward.


Console Output Example
Below is an excerpt from the Jenkins console log illustrating how the file is shared between containers:Comparing Jenkins Agent Strategies
Choose the right Jenkins agent model based on your infrastructure and maintenance requirements:| Agent Type | Description |
|---|---|
| Kubernetes Cloud Agent | On-demand Pods; auto-provisioned and cleaned up per job. |
| Docker Agent | Temporary containers managed by Jenkins; easy to customize. |
| Static Node | Always-on VMs or servers; requires manual OS and tool updates. |
Static nodes demand ongoing maintenance (OS patches, software upgrades). For most CI/CD workflows, dynamic agents reduce resource waste and simplify updates.