Hazelcast on Kubernetes cluster with management console.

926 views
Skip to first unread message

lukasz...@gmail.com

unread,
Nov 27, 2017, 5:14:20 PM11/27/17
to Hazelcast
Hi. Currently I'm checking some distributed cache solutions and I found this tutorial. I thought I'll just do whats there and it will work. 
https://blog.hazelcast.com/deploy-monitor/

Everything is running, I can create account at management console but then I see "No cluster data" dialog. 
Where should I setup hazelcast configuration? 


Guglielmo Nigri

unread,
Nov 28, 2017, 8:25:59 AM11/28/17
to Hazelcast
Hi Łukasz,

to solve this particular issue, you should enable the Management Center in the hazelcast.xml configuration file.

First, a bit of background info.
The blog post uses the plain hazelcast/hazelcast Docker image [1], which relies on multicast for cluster member discovery.
Currently, however, on Kubernetes it is advisable to use the new hazelcast/hazelcast-kubernetes Docker image [2], which uses the Hazelcast Kubernetes discovery plugin [3].

In order to override the default configuration you can follow the steps outlined in the README [4] to add a persistent volume. The example there is for GCE, but you can adapt it to Minikube, possibly using a mounted host folder [5] in a local dev/test environment.


Hope this helps.

We will probably publish an updated blog post about this!

Cheers,
Guglielmo

Łukasz Byjoś

unread,
Nov 28, 2017, 10:36:54 AM11/28/17
to Hazelcast
Hmm quick question, is possible to provide config.xml via url from for example gcloud storage? I found this in Ignite. There are options live persistent volume but also just via url in deployment
        - name: CONFIG_URI

Guglielmo Nigri

unread,
Nov 29, 2017, 8:33:52 AM11/29/17
to Hazelcast
We don't have that particular option available [1]. 
As an alternative, you could always create a custom Docker image to override the hazelcast.xml file.
HTH.

Cheers,
Guglielmo

Łukasz Byjoś

unread,
Nov 29, 2017, 4:05:50 PM11/29/17
to Hazelcast
Somehow I did it and manconsole shows pods. I had to set ip from hazelcast service. But now... I'm trying to use hazelcast cache with spring and connect it to nodes. 

I tried to add this deps
    compile 'com.hazelcast:hazelcast-all:3.9'
    compile 'com.github.hazelcast:hazelcast-kubernetes:v1.0.0'

    compile 'io.fabric8:kubernetes-client:3.1.0'
    compile 'io.fabric8:kubernetes-api:3.0.8'

but all the time I'm getting 

Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.NoClassDefFoundError: io/fabric8/kubernetes/client/EditableConfig

Bean with config

    @Bean
    public Config provideHConfig() {
        Config config = new Config();
        final NetworkConfig networkConfig = config.getNetworkConfig();
        networkConfig.getJoin().getTcpIpConfig().setEnabled(false);
        networkConfig.getJoin().getMulticastConfig().setEnabled(false);
        DiscoveryConfig discoveryConfig = networkConfig.getJoin().getDiscoveryConfig();
        final HazelcastKubernetesDiscoveryStrategyFactory strategyFactory = new HazelcastKubernetesDiscoveryStrategyFactory();
        discoveryConfig.addDiscoveryStrategyConfig(new DiscoveryStrategyConfig(strategyFactory));
        return config;
    }

Guglielmo Nigri

unread,
Dec 1, 2017, 9:59:35 AM12/1/17
to Hazelcast
Hi Łukasz,

Looks like dependencies mixed up, as hazelcast-kubernetes 1.0.0 uses kubernetes-client 1.3.66 (and not 3.1.0)


Hope this helps.

Cheers,
Guglielmo

Łukasz Byjoś

unread,
Dec 3, 2017, 11:57:58 AM12/3/17
to Hazelcast
With hazelcast.xml configuration it's connecting to cluster. But management console shows there is a problem with different configs. 
Currently I'll stick with Ignite and wait for better documentation how to use Hazelcast with Spring and Kubernetes. 

gugliel...@gmail.com

unread,
Dec 4, 2017, 3:58:37 PM12/4/17
to Hazelcast
So you are now able to run Hazelcast with a custom configuration on Kubernetes.
That's great news! I think you already surpassed the concepts introduced in the blog post.

Now you’re experiencing a problem with different configs. What is the problem, do you get an error message?

What is your configuration like?
Which version of Hazelcast / Management Center?

Happy to help if you could explain what you’re trying to accomplish and how.

Cheers,
Guglielmo

P.S. Since you mention documentation, there are great resources out there already!
Have you had a look at the Spring integration [1] and hazelcast-kubernetes Docker image [2] documentation?

Reply all
Reply to author
Forward
0 new messages