kaiyuanshe / kaiyuanshe/open-hackathon
容器化后将配置与代码分离
Open
enhancement
help wanted
- Dominant language
- C#
- Stars
- 57
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
现在的配置主要是修改 `config.py`,但是这样挂载配置的方式比较难做到配置和代码分离。
比较推荐的实践是使用文本格式的配置文件,比如 `.yml`,`.json`,`.conf` 等,在部署时,直接指定相应的文件,在容器启动时,将文本文件通过 volume 挂载到容器中,容器中的程序启动时 load。
在 K8s 中,一般通过 ConfigMap 托管文本配置文件,然后在 Deployment 配置使用该 ConfigMap,Pod 启动时,文本配置会通过 Volume 挂载在容器中。
样例:
在 K8s 使用 nginx 配置文件: https://gist.github.com/petitviolet/d36f33d145d0bbf4b54eb187b79d0244
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.