我正在尝试通过配置映射在 pod 中创建卷挂载。以下是我的定义文件:
配置图定义:
apiVersion: v1
kind: ConfigMap
metadata:
name: firstcm
data:
appname: springboot
database: inmemory
tool: h2
type: singlecontainer
部署定义:
apiVersion: apps/v1
kind: Deployment
metadata:
name: firstspring
labels:
app: firstspring
spec:
replicas: 1
selector:
matchLabels:
app: firstspring
template:
metadata:
labels:
app: firstspring
spec:
containers:
- name: firstspring
image: mukhou/firstspring
volumeMounts:
- name: firstvol
mountPath: /etc/config/db.properties
subPath: db.properties
volumes:
- name: firstvol
configMap:
name: firstcm
所有对象都创建得很好,我可以看到带有我放置的数据的配置图。但是从配置映射创建的 db.properties 文件是空的,里面没有数据。有谁知道我在这里想念什么?
drwxrwxrwx 2 root root 4096 Jun 6 00:17 db.properties
/etc/config # more db.properties/
/etc/config #