Skip to content

Instantly share code, notes, and snippets.

@tyzbit
Last active October 15, 2022 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyzbit/669331868fea29eb49437dff95d69051 to your computer and use it in GitHub Desktop.
Save tyzbit/669331868fea29eb49437dff95d69051 to your computer and use it in GitHub Desktop.
How to mount configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: file
namespace: default
data:
mycoolfile.txt: |
hey check out my cool file
apiVersion: apps/v1
kind: Deployment
metadata:
name: file-reader
namespace: default
labels:
app: file-reader
spec:
selector:
matchLabels:
app: file-reader
template:
metadata:
labels:
app: file-reader
spec:
containers:
- name: file-reader
image: ubuntu
command: ["sh","-c","cat /home/mycoolfile.txt && sleep 600"]
volumeMounts:
- mountPath: "/home/mycoolfile.txt"
subPath: "mycoolfile.txt"
name: file-configmap
volumes:
- name: file-configmap
configMap:
name: file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment