我们有一个docker镜像和一个相应的yaml文件,用于使用kubernetes进行部署。我们建立的应用程序是与akka-http的scala。我们使用了akka集群。在我们的应用代码中使用的配置文件中,我们有一个特殊的变量(我们的例子中的种子节点 - akka集群),它使用pod ip。但是,除非部署完成,否则我们不会获得pod ip。我们应该如何解决这个问题?如果是的话,环境变量会有帮助吗?Kubernetes - Akka集群部署
更具体地说,一旦泊坞窗图像部署在容器中的容器中,并且容器启动时,Pod容器已经被分配。那么,我们可以在容器中的流程开始之前以编程方式或以其他方式在代码或配置文件中配置pod ips吗?
以供参考,这是我们的配置文件:
akka {
actor {
provider = "akka.cluster.ClusterActorRefProvider"
}
remote {
log-remote-lifecycle-events = off
netty.tcp {
hostname = "127.0.0.1"
port = 0
}
}
cluster {
seed-nodes = [
"akka.tcp://[email protected]:3000",
"akka.tcp://[email protected]:3001",
],
metrics {
enabled = off
}
}
}
service {
validateTokenService {
ml.pubkey.path = "<filePath>"
}
ml_repository {
url = <url address>
}
replication.factor = 3
http.service.interface = "0.0.0.0"
http.service.port = 8080
}
在上面的文件,而不必akka.remote.netty.tcp.hostname为“127.0.0.1”,我们需要有荚-ip。
seed-nodes = [
"akka.tcp://[email protected]:3000",
"akka.tcp://[email protected]:3001",
],
我们怎么可以这样做: 所以,我们可以作为种子节点使用它? 在此先感谢。
看看这个伟大的博文http://paoloambrosio.net/2016/12/14/akka-location-transparency.html及其相关的GitHub演示项目https://github.com/paoloambrosio/experiments/树/阿卡位置透明度。解决方案是在Docker镜像启动过程中运行发现并导出种子主机名。 –