我在 kubernetes 集群中安装了 camel-k,并且有一条路径可以检查 git 存储库,如下所示。
// camel-k: language=java dependency=camel-git
import org.apache.camel.builder.RouteBuilder;
public class Gitlab extends RouteBuilder {
@Override
public void configure() throws Exception {
from("git:///tmp/config-service?remotePath=https://xxx&branchName=master&type=branch&username=xxx&password=xxx")
.transform().constant("checked-out").to("log:info");
}
}
但这给出了以下权限错误。当登录到 pod 并尝试在部署目录中创建文件或文件夹时,它会给出权限错误。有没有办法使用 Traits 或任何其他方法在容器内设置用户?
2020-10-06 11:31:46.667 ERROR [main] SystemReader - Creating XDG_CONFIG_HOME directory /deployments/?/.config failed
java.nio.file.AccessDeniedException: /deployments/?
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:689) ~[?:?]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:796) ~[?:?]
at java.nio.file.Files.createDirectories(Files.java:782) ~[?:?]