caching-springboot's People
caching-springboot's Issues
Hazelcast instance trying to access Kubernetes pods directly instead of load balancer's external IP
Hello,
I have a Hazelcast
cluster deployed in Minikube
with 2 members. I have set up a load balancer service to access these members. My Spring Boot application, which is deployed outside of Minikube
, uses the following configuration to initialize the Hazelcast
instance:
public Config getHazelcastConfig() {
Config config = new Config("default");
config.getNetworkConfig().setPort(5701);
config.getNetworkConfig().setPortCount(1);
config.getNetworkConfig().setPortAutoIncrement(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig()
.getJoin()
.getTcpIpConfig()
.addMember("external-ip:port")
.setEnabled(true);
return config;
}
@Bean
public HazelcastInstance hazelcastInstance() {
Config config = getHazelcastConfig();
return Hazelcast.newHazelcastInstance(config);
}
When I start the Spring Boot application for the first time after rebuilding it, I can successfully add the Minikube members to the cluster, resulting in a total of 3 members as expected. However, when I restart the application, it tries to access the Kubernetes pods directly using their private IP addresses. Here are the relevant logs:
2023-07-02 20:39:16.831 INFO 32243 --- [.IO.thread-in-0] c.h.i.server.tcp.TcpServerConnection : [10.31.0.28]:5701 [dev] [4.2.1] Initialized new cluster connection between /192.168.105.1:50190 and /10.108.94.145:5701
2023-07-02 20:39:16.898 INFO 32243 --- [cached.thread-3] c.h.i.server.tcp.TcpServerConnector : [10.31.0.28]:5701 [dev] [4.2.1] Connecting to /10.244.0.2:5701, timeout: 10000, bind-any: true
2023-07-02 20:39:26.902 INFO 32243 --- [cached.thread-3] c.h.i.server.tcp.TcpServerConnector : [10.31.0.28]:5701 [dev] [4.2.1] Could not connect to: /10.244.0.2:5701. Reason: IOException[null to address /10.244.0.2:5701]
2023-07-02 20:39:26.903 INFO 32243 --- [cached.thread-3] c.h.internal.cluster.impl.TcpIpJoiner : [10.31.0.28]:5701 [dev] [4.2.1] [10.244.0.2]:5701 is added to the blacklist.
2023-07-02 20:39:36.939 INFO 32243 --- [cached.thread-3] c.h.internal.cluster.impl.TcpIpJoiner : [10.31.0.28]:5701 [dev] [4.2.1] [10.244.0.2]:5701 is added to the blacklist.
The IP 10.244.0.2
corresponds to one of the Kubernetes pods (members). However, my application should only access the members through the load balancer's external IP. I'm not sure why it's trying to access the pods directly.
How can I enforce my Hazelcast
instance to always access the members via the load balancer's external IP? Any guidance or suggestions would be greatly appreciated.
Note: I am not using the ClientConfig
because Im trying to add the members deployed in Kubernetes as new members along with the one member which starts with my spring boot application.
I have setup my Minikube
referring this
Thank you.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.