Last active
March 13, 2023 08:40
-
-
Save resouer/378bcdaef1d9601ed6aa to your computer and use it in GitHub Desktop.
How to implement volumes-from in Kubernetes Pod?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: server | |
spec: | |
containers: | |
- image: resouer/sample:v2 | |
name: war | |
lifecycle: | |
postStart: | |
exec: | |
command: | |
- "cp" | |
- "/sample.war" | |
- "/app" | |
volumeMounts: | |
- mountPath: /app | |
name: hostv1 | |
- name: peer | |
image: busybox | |
command: ["tail", "-f", "/dev/null"] | |
volumeMounts: | |
- name: hostv2 | |
mountPath: /app/sample.war | |
volumes: | |
- name: hostv1 | |
hostPath: | |
path: /tmp | |
- name: hostv2 | |
hostPath: | |
path: /tmp/sample.war |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guys, this can be solved more elegant by using
initContainer
, see my update in the original answer: http://stackoverflow.com/questions/30538210/how-to-mimic-volumes-from-in-kubernetes/33118902#33118902