Hazelcast Helm Chart

Facebooktwittergoogle_plusredditlinkedin

Hazelcast was recently published in a form of Helm Chart. It means that now deploying a fully-functional Hazelcast cluster on Kubernetes is easier than ever.

Prerequisites

To use Helm Charts you need to:

  • Install Helm tool
  • Install Tiller (server side of Helm), just execute “$ helm init

Installing Hazelcast Helm Chart

To install Hazelcast Helm Chart, run the following command.

$ helm install stable/hazelcast 

That’s all! Your cluster Hazelcast is already deployed and running. You can check it with the following command:

$ kubectl get all
NAME                           READY     STATUS    RESTARTS   AGE
pod/altered-swan-hazelcast-0   1/1       Running   0          1m
pod/altered-swan-hazelcast-1   1/1       Running   0          1m

NAME                             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/altered-swan-hazelcast   ClusterIP   10.19.240.140           5701/TCP   1m
service/kubernetes               ClusterIP   10.19.240.1             443/TCP    1d

NAME                                      DESIRED   CURRENT   AGE
statefulset.apps/altered-swan-hazelcast   2         2         1m

If you want to confirm that the Hazelcast members really formed a cluster, you check the logs of any Hazelcast POD.

$ kubectl logs pod/altered-swan-hazelcast-1
...
Members {size:2, ver:2} [
        Member [10.16.1.13]:5701 - 46f5815a-a892-4091-b4d3-bb6940a80663
        Member [10.16.1.14]:5701 - e9244db3-f305-4377-8a81-ef4e89f6add6 this
]
...

Note that you can add some configuration to your Hazelcast cluster. For example, if you wanted 3 Hazelcast members instead of 2, you could run:

$ helm install stable/hazelcast --set cluster.memberCount=3

For all parameters, please check the documentation.

Using Hazelcast Cluster

When the Hazelcast cluster is up and running, you can use it by a sample application deployed on Kubernetes. Here’s how Hazelcast Client could be configured in Java.

public ClientConfig clientConfig() {
    ClientConfig config = new ClientConfig();
    config.getNetworkConfig().getKubernetesConfig().setEnabled(true);
    return config;
}

Note that you need to have the latest Maven/Gradle dependencies: “com.hazelcast:hazelcast-client“, “com.hazelcast:hazelcast“, and “com.hazelcast:hazelcast-kubernetes“.

Management Center and Hazelcast Enterprise

There are also additional Helm Charts hosted in the Hazelcast Helm Chart repository:

If you want to deploy Hazelcast with Management Center, all you need to do is to add Hazelcast repository to your Helm tool and install Hazelcast.

$ helm repo add hazelcast https://hazelcast.github.io/charts/ 
$ helm repo update
$ helm install hazelcast/hazelcast 

Then, you should see your Hazelcast cluster and the Management Center application.

$ kubectl get all
NAME                                                        READY     STATUS    RESTARTS   AGE
pod/lovely-greyhound-hazelcast-0                            1/1       Running   0          8m
pod/lovely-greyhound-hazelcast-1                            1/1       Running   0          7m
pod/lovely-greyhound-hazelcast-mancenter-7d6c7c4f67-929mq   1/1       Running   0          8m

NAME                                           TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)          AGE
service/kubernetes                             ClusterIP      10.19.240.1                443/TCP          1d
service/lovely-greyhound-hazelcast             ClusterIP      10.19.250.167              5701/TCP         8m
service/lovely-greyhound-hazelcast-mancenter   LoadBalancer   10.19.248.101   35.238.106.196   8080:31029/TCP   8m

NAME                                                         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.extensions/lovely-greyhound-hazelcast-mancenter   1         1         1            1           8m

NAME                                                                    DESIRED   CURRENT   READY     AGE
replicaset.extensions/lovely-greyhound-hazelcast-mancenter-7d6c7c4f67   1         1         1         8m

NAME                                                   DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/lovely-greyhound-hazelcast-mancenter   1         1         1            1           8m

NAME                                                              DESIRED   CURRENT   READY     AGE
replicaset.apps/lovely-greyhound-hazelcast-mancenter-7d6c7c4f67   1         1         1         8m

NAME                                          DESIRED   CURRENT   AGE
statefulset.apps/lovely-greyhound-hazelcast   2         2         8m

You can access Management Center by the URL specified in LoadBalancer: “http://<EXTERNAL-IP>:8080/hazelcast-mancenter“.

For the instructions on how to deploy Hazelcast Enterprise, please check this.

Leave a Reply