Getting this error.
Error: failed to prepare subPath for volumeMount "solr-collection-config" of container "upload-config-container"
Using kubernetes 1.10.11
- name: upload-config-container image: solr:7.4.0-alpine imagePullPolicy: Always resources: requests: memory: "128Mi" cpu: "100m" limits: memory: "256Mi" cpu: "200m" volumeMounts: - name: solr-collection-config mountPath: /tell/carbon/conf subPath: conf
solr-collection-config
is a volume that represents a ConfigMap
volumes: - name: solr-collection-config configMap: name: solr-collection-resources items: - key: stopwords_en.txt path: "conf/lang/stopwords_en.txt" - key: _rest_managed.json path: "conf/_rest_managed.json" - key: currency.xml path: "conf/currency.xml" - key: protwords.txt path: "conf/protwords.txt" - key: schema.xml path: "conf/schema.xml" - key: solrconfig.xml path: "conf/solrconfig.xml" - key: stopwords.txt path: "conf/stopwords.txt" - key: synonyms.txt path: "conf/synonyms.txt" restartPolicy: Never
Help is kindly appreciated. Thank you
What happens if you do not use subPath
?
All keys from configMap will be mounted in directory /tell/carbon/conf
. That means, every key will be a separate file under this directory.
Now, what this subPath
does? From your example,
volumeMounts:
- name: solr-collection-config
mountPath: /tell/carbon/conf
subPath: conf
Means, key conf
from configMap will be mounted as file conf
under /tell/carbon
directory.
But, you do not have this key. So getting this error.
Error: failed to prepare subPath for volumeMount "solr-collection-config" of container "upload-config-container"
Now, you can do like this
volumeMounts:
- name: solr-collection-config
mountPath: /tell/carbon/conf
subPath: stopwords_en.txt
Which means, value of stopwords_en.txt
from your configMap will be mounted as conf
file under /tell/carbon
.
Final words, this subPath
is actually a path from volume, from where your data is coming. In your case, subPath
should be one of the key from your configMap