k8s(7) : 基于centos加工的容器启动springboot服务configmap参数注入
加工说明 :docker(12) : centos7.8镜像加工_Lxinccode的博客-CSDN博客情景修改[startup.sh]文件的内容为java使用jar启动springboot服务,如下java -jar test.tar --spring.profiles.active=${spring_profiles_active} \--server.port=${server_port}注
·
加工说明 : docker(12) : centos7.8镜像加工_Lxinccode的博客-CSDN博客
情景
修改[startup.sh]文件的内容为java使用jar启动springboot服务,如下
java -jar test.tar --spring.profiles.active=${spring_profiles_active} \
--server.port=${server_port}
注 : ${spring_profiles_active} 不可改为 ${spring.profiles.active}
操作
k8s deployment.yaml注入configmap格式如下
- name: spring_profiles_active
valueFrom:
configMapKeyRef:
name: test-config
key: SPRING_PROFILES_ACTIVE
- name: server_port
valueFrom:
configMapKeyRef:
name: test-config
key: SERVER_PORT
k8s configmap内容如下
apiVersion: v1
kind: ConfigMap
metadata:
name: test-config
namespace: default
data:
SPRING_PROFILES_ACTIVE: "prod"
SERVER_PORT: "80"
更多推荐



所有评论(0)