转自https://blog.csdn.net/weixin_34102807/article/details/85965725

1、新建ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
name: test-conf
namespace: default
labels:
name: test-conf
data:
test.properties: |
db.url=jdbc:oracle:thin:@172.16.10.178:1521:orcl
db.user=sz_res
db.passwd=sz_res
test2.properties: |
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

2、新建deployment

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: test-app
namespace: default
spec:
replicas: 1
template:
metadata:
labels:
app: test-app
spec:
containers:
- name: test-container
image: test/tomcat:v1
imagePullPolicy: Always
volumeMounts:
- name: test
mountPath: /usr/local/tomcat/webapps/test/WEB-INF/classes/test.properties
subPath: path/to/test.properties
- name: test2
mountPath: /usr/local/tomcat/webapps/test/WEB-INF/classes/test2.properties
subPath: path/to/test2.properties
volumes:
- name: test
configMap:
name: test-conf
defaultMode: 0777
items:
- key: test.properties
path: path/to/test.properties
- name: test2
configMap:
name: test-conf
items:
- key: test2.properties
path: path/to/test2.properties

挂载容器内部的文件的权限。(必须是介于0和0777(八进制)之间的数字,包括两者在内)

其实我没搞懂path/to/的意思

不过照着搬,的确好用,那就当作固定用法吧,

最新文章

  1. spring3.0使用annotation完全代替XML(三)
  2. 2015-SH项目总结
  3. BNUOJ48605International Collegiate Routing Contest 题解
  4. 学会使用Chromium中的LOG
  5. WPF 数据绑定
  6. Python脚本控制的WebDriver 常用操作 <十> 层级定位
  7. 【First Missing Positive】cpp
  8. ios开发多线程--GCD
  9. Linux 操作系统的用户和用户组管理
  10. Altium Designer 6三维元件库建模教程
  11. Eclipse自动插件依赖的一种配置解决方式
  12. (转) 新手入门:C/C++中的结构体
  13. CSM认证培训知识汇总
  14. PHP面试随笔
  15. Js高级程序设计~读书笔记
  16. printf scanf cin cout的区别与特征
  17. 第 8 章 容器网络 - 061 - flannel 的连通与隔离
  18. include_path='.;C:\php5\pear'解决方法
  19. 【PHP】 curl 上传文件 流
  20. sql server 运算

热门文章

  1. 使用 Tye 辅助开发 k8s 应用竟如此简单(六)
  2. centos7 SNMP错误记录
  3. Java实现贪吃蛇
  4. CVE-2016-5734-phpmyadmin-4.0.x-4.6.2-代码执行
  5. Java传参:值传递 or 引用传递 ?
  6. NET 5.0 Swagger API 自动生成MarkDown文档
  7. swing实现QQ登录界面1.0( 实现了同一张图片只加载一次)、(以及实现简单的布局面板添加背景图片控件的标签控件和添加一个关闭按钮控件)
  8. Spring框架的介绍
  9. DNS 缓存中毒--Kaminsky 攻击复现
  10. Android Studio 如何更新到新版本