Kintarō
Kintarō

Reputation: 3177

How to mount a single non config file in Kubernetes?

I have a deployment which requires to read a license file from a host. The license file is a text file (not a yaml config). I know we can mount a ConfigMap in a deployment but afaik ConfigMap is only in yaml format.

What is the best way to mount this single file into a deployment?

Upvotes: 1

Views: 438

Answers (1)

Burak Serdar
Burak Serdar

Reputation: 51467

You can create a configmap from any file:

kubectl create configmap <map-name> --from-file=file.cfg

Then you can mount the configmap to your pod:

volumes:
  - name: config
    configMap:
      name: mapName
volumeMounts:
  - name: config
    mountPath: /dir/file.cfg
    subPath: file.cfg

Upvotes: 3

Related Questions