Skip to content

Instantly share code, notes, and snippets.

@tuannvm
Created April 14, 2017 03:32
Show Gist options
  • Save tuannvm/0fc6e94a3759c91b1abe71c149152f77 to your computer and use it in GitHub Desktop.
Save tuannvm/0fc6e94a3759c91b1abe71c149152f77 to your computer and use it in GitHub Desktop.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
name: test
spec:
replicas: 1
template:
metadata:
creationTimestamp: null
labels:
service: test
spec:
containers:
image: test
name: test
ports:
- containerPort: 80
resources:
limits:
memory: 300Mi
requests:
memory: 100Mi
volumeMounts:
- name: "config"
mountPath: "/<existing folder>/<file1>"
subPath: "<file1>"
- name: "config"
mountPath: "/<existing folder>/<file2>"
subPath: "<file2>"
restartPolicy: Always
volumes:
- name: "config"
configMap:
name: "config"
restartPolicy: Always
status: {}
@abdennour
Copy link

subPath is now deprecated

@Flouse
Copy link

Flouse commented Aug 18, 2020

so, what is the best practice to mount single file into existing directory?

@yardenshoham
Copy link

yardenshoham commented Mar 8, 2021

@abdennour why do you think it's deprecated?

@abdennour
Copy link

i am pretty sure that i put that comment based on the official documentation of k8s.

@yardenshoham
Copy link

@abdennour can you link to it?

@Billyzou0741326
Copy link

@FrolovVyacheslav
Copy link

@abdennour kubernetes v1.24 subPath is still not deprecated...

@rafi
Copy link

rafi commented Jul 13, 2023

Be aware that using subPath has the downside of not updating the file when ConfigMap changes.

@589290
Copy link

589290 commented Dec 3, 2023

Be aware that using subPath has the downside of not updating the file when ConfigMap changes.

Unless you restart the pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment