1. 如果需要往pod上面传配置文件或者配置信息

oc create configmap test --from-file=test.json

建成configmap后,需要挂载到volumn上,这样文件就会挂载到、/etc/config/test.json

其实官方给的教程是pod, 但是使用template的时候, 没有pod,所以挂载到DeploymentConfig -> spec=>template->configmap->volumn

2. 如果需要把值传递给pod的环境变量

用container -> environment

 

3. 启动 oc process -f template.yml | oc apply -f

 

4.挂载到volume上的文件和值可以映射到pod上或者DeploymentConfig

kind: v1

type: DeploymentConfig

spec:

  template:

    spec:

      container:

        -name: test

        volumeMounts:

          -name: config

          mountPath: /etc/config

      volumes:

        - name: config

          configmap:

          -name: hello-env-config    

 

posted on 2021-06-25 00:45  connie313  阅读(53)  评论(0编辑  收藏  举报