Pod中使用ConfigMap的方法(pod只能使用相同命名空间中的configmap)
Pod中使用ConfigMap的方法(pod只能使用相同命名空间中的configmap)
在Pod中使用ConfigMap配置环境变量:
apiVersion: v1kind: Podmetadata: name: configmap-demo-podspec: containers: - name: demo image: alpine command: ["sleep", "3600"] env: - name: PLAYER_INITIAL_LIVES valueFrom: configMapKeyRef: name: my-config key: player_initial_lives - name: UI_PROPERTIES_FILE_NAME valueFrom: configMapKeyRef: name: my-config key: ui_properties_file_name
在Pod中使用ConfigMap挂载配置文件:
apiVersion: v1kind: Podmetadata: name: configmap-demo-podspec: containers: - name: demo image: alpine command: ["sleep", "3600"] volumeMounts: - name: config mountPath: "/config" readOnly: true volumes: - name: config configMap: name: my-config items: - key: "game.properties" path: "game.properties"
发表评论
暂时没有评论,来抢沙发吧~