ConfigMaps 的 OpenShift 文档 ( https://docs.openshift.com/enterprise/3.2/dev_guide/configmaps.html ) 只是在 Pod 中使用的一个示例。但是我也可以在 DeploymentConfig 中使用 ConfigMaps 吗?
Pod 中的参数声明与 DeploymentConfig 类似。
apiVersion: v1
kind: Pod
metadata:
name: dapi-test-pod
spec:
containers:
- name: test-container
image: gcr.io/google_containers/busybox
command: [ "/bin/sh", "-c", "env" ]
env:
- name: SPECIAL_LEVEL_KEY
valueFrom:
configMapKeyRef:
name: special-config
key: special.how
- name: SPECIAL_TYPE_KEY
valueFrom:
configMapKeyRef:
name: special-config
key: special.type
restartPolicy: Never
两者都使用该env
物业。
"spec": {
"containers": [
{
"env": [
{
"name": "PORT",
"value": "${MF-PORT}"
},
{
"name": "NODE_ENV",
"value": "${MF-ENVIRONMENT}"
}
],