-
Notifications
You must be signed in to change notification settings - Fork 38.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
link volume from existing container to another container in a pod #6120
Comments
We so not have a way to link data from one container into another. To do Instead, you can publish the data to the shared volume and see it in both What is running in your container-a?
|
Publish means "copy" here. I dont know if there is a lighter weight way
|
+1 |
We’re going through old support issues and asking everyone to direct your questions to stackoverflow. We are trying to consolidate the channels to which questions for help/support are posted so that we can improve our efficiency in responding to your requests, and to make it easier for you to find answers to frequently asked questions and how to address common use cases. We regularly see messages posted in multiple forums, with the full response thread only in one place or, worse, spread across multiple forums. Also, the large volume of support issues on github is making it difficult for us to use issues to identify real bugs. The Kubernetes team scans stackoverflow on a regular basis, and will try to ensure your questions don't go unanswered. |
+1 |
1 similar comment
+1 |
I just came across this issue, because I had the same problem and crafted a solution using shareProcessNamespace. see my answer here: https://stackoverflow.com/a/76629218/8079928 or this gist: apiVersion: apps/v1
kind: Deployment
metadata:
name: datasharing
spec:
selector:
matchLabels:
app: datasharing
template:
metadata:
labels:
app: datasharing
spec:
shareProcessNamespace: true
containers:
- name: data
image: ubuntu
imagePullPolicy: IfNotPresent
command: ["/bin/bash", "-c"]
args: ["trap 'echo signal;exit 0' SIGINT; sleep infinity"]
resources:
limits:
memory: "128Mi"
cpu: "500m"
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- mkdir -p /DATA && touch /DATA/empty_test_file
- name: nginx
image: nginx:stable
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 8080
env:
- name: GET_DATA_PROC_DIR
value: 'find /proc -maxdepth 1 -type d -regex "/proc/[0-9]*" | head -2 | tail -1'
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- ln -s $(eval $GET_DATA_PROC_DIR)/root/DATA /mnt/DATA |
I have 2 containers in a pod.
I have some files in
container a
that needs to be accessed bycontainer b
I'm not sure how I can achieve this.
The contents of
/data
incontainer a
becomes empty which has the content to be shared.The text was updated successfully, but these errors were encountered: