一、SpringMVC项目(hello-server服务为例)
1、dockerfile添加
RUN touch /usr/local/tomcat/bin/setenv.sh && chmod +x /usr/local/tomcat/bin/setenv.sh && echo "CLASSPATH=/hello-server/config " >/usr/local/tomcat/bin/setenv.sh
2、创建configmap
创建config目录,目录下存放xx.properties,xxx.properties配置文件,进入目录。
kubectl create configmap hello-config --from-file=xx. properties --from-file=xxx.properties
3、yaml文件创建Deployment
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: hello-server
spec:
replicas: 1
template:
metadata:
labels:
app: hello-server
spec:
containers:
- name: hello
image: 172.31.202.26:80/hello-server:latest
im