Red Hat Camel K is no longer supported.
As of June 30, 2025, Red Hat build of Camel K has reached End of Life. The suggested replacements is Red Hat build of Apache Camel. For details about moving, see the Camel K to Camel Quarkus migration guide.4.2.3.4. 为资源指定目标路径
/etc/camel/resources/
目录是挂载使用 --resource
选项指定的资源的默认位置。如果您需要指定要在其上挂载资源的不同目录,请使用 --resource @path
语法。
先决条件
- 设置 Camel K 开发环境
- 您有一个包含一个或多个配置属性的文件、ConfigMap 或 Secret。
流程
创建一个 Camel K 集成来引用包含配置属性的文件、ConfigMap 或 Secret。例如,以下集成(名为
ResourceFileLocationRoute.java
)引用myprops
文件:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行集成并使用
--resource
选项及@path
语法,并指定挂载资源内容(文件、ConfigMap 或 Secret)的位置:例如,以下命令指定使用
/tmp
目录挂载input.txt
文件:kamel run --resource file:resources-data.txt@/tmp/input.txt ResourceFileLocationRoute.java --dev
kamel run --resource file:resources-data.txt@/tmp/input.txt ResourceFileLocationRoute.java --dev
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 检查集成的 pod,以验证文件(例如
input.txt
)已挂载到正确的位置(例如,在tmp
目录中)。例如,运行以下命令:oc exec <pod-name> -- cat /tmp/input.txt
oc exec <pod-name> -- cat /tmp/input.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow