'Kubernetes storing persistent files
What's the best way to store a persistent file in Kubernetes? I have a cert (.pfx) and I want to be passing to the application its path. From the looks of it it can't be stored in secrets. Was thinking about a volume but the question is how do I upload the file to it? And which type of volume to choose? Or is there any other efficient way?
Solution 1:[1]
you can copy your ".pfx" file into local directory like "/home/certs/" and than mount this directory inside to your pod,check below yaml
kind: Pod
apiVersion: v1
metadata:
name: secret-test-pod
spec:
volumes:
- name: localhostpath
hostPath:
path: /home/certs # path on local file system
type: DirectoryOrCreate # create if not exist
containers:
- name: ...
image: ...
volumeMounts:
- name: localhostpath
mountPath: "/root/certs" # path inside pod or containers
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
