自定义 configMapGenerator
Kustomize configMapGenerator
在 kubernetes kustomize.yml 中,当我使用 configMapGenerator 将一些值作为 env 传递时,我可以在已部署的 springboot 应用程序 application.properties 文件中访问这些变量吗?
kustomize.yml
...
configMapGenerator:
- name: test-app-config
env: ./test/applicationsetup.env
...
test/applicationsetup.env
some_key=data1
some_key1=data2
application.properties
APPLICATION_KEY=${some_key}
APPLICATION_KEY1=${some_key1}
我错过了在我尝试访问数据的容器中添加 configMapRef。
containers:
- name: test-container
image: <image>
envFrom:
- configMapRef:
name: test-app-config
在 kubernetes kustomize.yml 中,当我使用 configMapGenerator 将一些值作为 env 传递时,我可以在已部署的 springboot 应用程序 application.properties 文件中访问这些变量吗?
kustomize.yml
...
configMapGenerator:
- name: test-app-config
env: ./test/applicationsetup.env
...
test/applicationsetup.env
some_key=data1
some_key1=data2
application.properties
APPLICATION_KEY=${some_key}
APPLICATION_KEY1=${some_key1}
我错过了在我尝试访问数据的容器中添加 configMapRef。
containers:
- name: test-container
image: <image>
envFrom:
- configMapRef:
name: test-app-config