![](/img/trans.png)
[英]Can't read configMap with name: [my-configmap] in namespace:[my-namespace]. Ignoring
[英]can't populate volume using configMap
我正在嘗試運行一個springboot應用程序,其application.properties文件將用作kubernetes configMap。
在部署應用程序時,我正在為此配置文件添加一個卷。 但不知何故,它不是在mount路徑上創建屬性文件。
configMap name:integration-properties數據:
application.properties:
http.stub.api.host=localhost
http.stub.api.port=8080
http.stub.api.path=stub-api
Deployment.yaml文件:
volumeMounts:
- name: config-volume
mountPath: /opt/build/
volumes:
- name: config-volume
configMap:
name: integration-properties
items:
- key: application.properties
path: application.properties
當我運行這個應用程序時,它說“/opt/build/application.properties”不存在。
如果需要進一步配置,請告知我們,如果有的話,請執行相應的步驟。
所以將configMap定義為:
data:
application.properties: |
http.stub.api.host=localhost
http.stub.api.port=8080
http.stub.api.path=stub-api
或者您也可以直接從application.properties
文件創建
kubectl create configmap integration-properties --from-file=application.properties=<path to file>
您的deployment.yaml
文件對我來說很好,沒有任何問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.