This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.22.2.2. 从文件创建
您还可以使用特定文件传递 --from-file
选项,并多次将 --from-file 传递给 CLI。以下示例生成与从目录创建示例相同的结果:
创建
ConfigMap
指定特定文件:oc create configmap game-config-2 \ --from-file=example-files/game.properties \ --from-file=example-files/ui.properties
$ oc create configmap game-config-2 \ --from-file=example-files/game.properties \ --from-file=example-files/ui.properties
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 验证结果:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
您还可以通过传递一个 key=value
表达式,将键设置为用于单独的文件(带有 --from-file
选项)。例如:
创建
ConfigMap
指定键值对:oc create configmap game-config-3 \ --from-file=game-special-key=example-files/game.properties
$ oc create configmap game-config-3 \ --from-file=game-special-key=example-files/game.properties
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 验证结果:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow