Need to run copy script that will copy some files to mounted path [init-container]Kubernetes restarting podsUnable to mount MySQL data volume to Kubernetes Minikube podKubernetes Volume mountpathFile Permission error in Google Cloud (GKE) Kubernetes Docker ContainerApache Tomcat is not finishing startup after deployed in Minikube - KubernetesDocker Tomcat container error: Caused by: java.lang.NoClassDefFoundError— when deployed in KubernetesKubernetes docker volume mounting optionDockerizing Spring boot application for Kubernetes DeploymentKubernetes not copying data into mounted Volumek8s: copy file to container after pod's deployment
How to take the beginning and end parts of a list with simpler syntax?
Plotting octahedron inside the sphere and sphere inside the cube
Simplification of numbers
Is this n-speak?
How to describe accents?
Markov-chain sentence generator in Python
Submitting a new paper just after another was accepted by the same journal
Can "être sur" mean "to be about" ?
What are these funnel-looking green things in my yard?
AsyncDictionary - Can you break thread safety?
When were the tantalum capacitors first used in computing?
Took GRE two times, same scores with minor differences - worth sending both?
Solution to German Tank Problem
PhD advisor lost funding, need advice
Why is there a large performance impact when looping over an array over 240 elements?
These were just lying around
Loading military units into ships optimally, using backtracking
What is this 1990s horror game of otherworldly PCs dealing with monsters on modern Earth?
Is 悪いところを見つかった proper Japanese?
Is it okay for a ticket seller in the USA to refuse to give you your change, keep it for themselves and claim it's a tip?
Why does the standard fingering / strumming for a D maj chord leave out the 5th string?
Is there any way to stop a user from creating executables and running them?
how do companies get money from being listed publicly
When does Tiana, Ship's Caretaker check card type?
Need to run copy script that will copy some files to mounted path [init-container]
Kubernetes restarting podsUnable to mount MySQL data volume to Kubernetes Minikube podKubernetes Volume mountpathFile Permission error in Google Cloud (GKE) Kubernetes Docker ContainerApache Tomcat is not finishing startup after deployed in Minikube - KubernetesDocker Tomcat container error: Caused by: java.lang.NoClassDefFoundError— when deployed in KubernetesKubernetes docker volume mounting optionDockerizing Spring boot application for Kubernetes DeploymentKubernetes not copying data into mounted Volumek8s: copy file to container after pod's deployment
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will
- have a script [shell or python]
- create a volume and mount it to the main container
- copy the property files from my local system to the mounted
volume. - then init-container finishes app container starts after this.
for example:
on my local I have the following:
/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh
init container should run a script wrapper.sh to copy these
files into the mounted volume on app container
which is /usr/share/jack-configs/
kubernetes
add a comment |
I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will
- have a script [shell or python]
- create a volume and mount it to the main container
- copy the property files from my local system to the mounted
volume. - then init-container finishes app container starts after this.
for example:
on my local I have the following:
/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh
init container should run a script wrapper.sh to copy these
files into the mounted volume on app container
which is /usr/share/jack-configs/
kubernetes
What did you try so far, and where are you stuck exactly?
– Webber
Mar 27 at 9:32
This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.
– David Maze
Mar 27 at 11:23
add a comment |
I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will
- have a script [shell or python]
- create a volume and mount it to the main container
- copy the property files from my local system to the mounted
volume. - then init-container finishes app container starts after this.
for example:
on my local I have the following:
/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh
init container should run a script wrapper.sh to copy these
files into the mounted volume on app container
which is /usr/share/jack-configs/
kubernetes
I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will
- have a script [shell or python]
- create a volume and mount it to the main container
- copy the property files from my local system to the mounted
volume. - then init-container finishes app container starts after this.
for example:
on my local I have the following:
/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh
init container should run a script wrapper.sh to copy these
files into the mounted volume on app container
which is /usr/share/jack-configs/
kubernetes
kubernetes
edited Mar 27 at 11:58
A_Suh
1,5381 silver badge9 bronze badges
1,5381 silver badge9 bronze badges
asked Mar 27 at 9:30
Tuhin Subhra MandalTuhin Subhra Mandal
666 bronze badges
666 bronze badges
What did you try so far, and where are you stuck exactly?
– Webber
Mar 27 at 9:32
This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.
– David Maze
Mar 27 at 11:23
add a comment |
What did you try so far, and where are you stuck exactly?
– Webber
Mar 27 at 9:32
This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.
– David Maze
Mar 27 at 11:23
What did you try so far, and where are you stuck exactly?
– Webber
Mar 27 at 9:32
What did you try so far, and where are you stuck exactly?
– Webber
Mar 27 at 9:32
This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.
– David Maze
Mar 27 at 11:23
This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.
– David Maze
Mar 27 at 11:23
add a comment |
1 Answer
1
active
oldest
votes
You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.
Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.
This docs shows how to do what you want.
An example YAML is the following:
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:
To accomplish what you want, you have to change the command
in the init container to execute your script, this bit I leave you try.
PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373796%2fneed-to-run-copy-script-that-will-copy-some-files-to-mounted-path-init-containe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.
Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.
This docs shows how to do what you want.
An example YAML is the following:
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:
To accomplish what you want, you have to change the command
in the init container to execute your script, this bit I leave you try.
PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
add a comment |
You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.
Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.
This docs shows how to do what you want.
An example YAML is the following:
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:
To accomplish what you want, you have to change the command
in the init container to execute your script, this bit I leave you try.
PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
add a comment |
You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.
Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.
This docs shows how to do what you want.
An example YAML is the following:
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:
To accomplish what you want, you have to change the command
in the init container to execute your script, this bit I leave you try.
PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another
You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.
Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.
This docs shows how to do what you want.
An example YAML is the following:
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:
To accomplish what you want, you have to change the command
in the init container to execute your script, this bit I leave you try.
PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another
answered Mar 27 at 9:38
Diego MendesDiego Mendes
6,3321 gold badge19 silver badges29 bronze badges
6,3321 gold badge19 silver badges29 bronze badges
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
add a comment |
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
yes I am exploring that bit...changing wget to copy command or embedding a script here
– Tuhin Subhra Mandal
Mar 27 at 10:26
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373796%2fneed-to-run-copy-script-that-will-copy-some-files-to-mounted-path-init-containe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What did you try so far, and where are you stuck exactly?
– Webber
Mar 27 at 9:32
This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.
– David Maze
Mar 27 at 11:23