Created
December 4, 2017 10:03
-
-
Save rk295/33eb4f973f51e9dc7dfb1319d8c6aaea to your computer and use it in GitHub Desktop.
This file contains 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: | |
labels: | |
app: nginx | |
name: nginx-test | |
namespace: default | |
spec: | |
containers: | |
- image: nginx | |
imagePullPolicy: Always | |
name: nginx | |
volumeMounts: | |
- mountPath: /usr/share/nginx/html | |
name: shared-volume | |
- image: ubuntu | |
imagePullPolicy: Always | |
name: ubuntu | |
command: ["/usr/bin/tail"] | |
args: ["-f", "/dev/null"] | |
volumeMounts: | |
- mountPath: /shared | |
name: shared-volume | |
volumes: | |
- name: shared-volume | |
emptyDir: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The two containers -
nginx
andubuntu
- spin up inside the same pod and share a filesystem between them. This is mounted under/shared
inside theubuntu
container and/usr/share/nginx/html
in thenginx
container. If you port forward port80
to the nginx container and try to web browse to it you will see a403
because there is noindex.html
. If you then exec a shell into theubuntu
container and run:Then reload the page served by
nginx
, you'll see a web page with the stringhello
on it. Proving the two containers are sharing a filesystem.