Pricing
Chat
Contact

Hazelcast Helm Chart

June 24, 2020

Note: This blog was originally published in November 2018, but has since been updated with the latest information.

Hazelcast is 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:

  • Kubernetes cluster with kubectl configured
  • Helm 3 tool installed

Installing Hazelcast Helm Chart

To install Hazelcast Helm Chart, run the following commands.

$ helm repo add hazelcast https://hazelcast-charts.s3.amazonaws.com/
$ helm repo update
$ helm install my-release hazelcast/hazelcast

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

$ kubectl get pods
NAME                                   READY     STATUS    RESTARTS   AGE
pod/my-release-hazelcast-0             1/1       Running   0          117s
pod/my-release-hazelcast-1             1/1       Running   0          76s
pod/my-release-hazelcast-2             1/1       Running   0          28s
pod/my-release-hazelcast-mancenter-0   1/1       Running   0          117s

NAME                             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/kubernetes               ClusterIP   10.19.240.1                   443/TCP    1d
service/my-release-hazelcast     ClusterIP   10.19.240.140                 5701/TCP   1m
service/my-release-hazelcast-mancenter   LoadBalancer   10.27.243.199   35.225.250.139   8080:31731/TCP,443:30457/TCP   117s

NAME                                              READY   AGE
statefulset.apps/my-release-hazelcast             3/3     118s
statefulset.apps/my-release-hazelcast-mancenter   1/1     118s

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

$ kubectl logs pod/my-release-hazelcast-0
...
Members {size:3, ver:3} [
        Member [10.16.1.13]:5701 - 46f5815a-a892-4091-b4d3-bb6940a80663 this
        Member [10.16.1.14]:5701 - e9244db3-f305-4377-8a81-ef4e89f6add6
        Member [10.16.1.15]:5701 - e9244db3-f305-4377-8a81-ef4e89f6add6
]
...

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

$ helm install my-release hazelcast/hazelcast --set cluster.memberCount=4

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 include the latest Maven/Gradle dependency: “com.hazelcast:hazelcast-all“.

Using Management Center

By default, Management Center is installed together with Hazelcast cluster.  You can access it via LoadBalancer external IP.

$ kubectl get service my-release-hazelcast-mancenter
NAME                             TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                        AGE
my-release-hazelcast-mancenter   LoadBalancer   10.27.243.199   35.225.250.139   8080:31731/TCP,443:30457/TCP   10m

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

Note that you can also use NodePort or Ingress to access Management Center application.

Other Hazelcast Charts

Similar to Hazelcast, you can install other charts:

About the Author

About the Author

Rafal Leszko

Rafal Leszko

Cloud Software Engineer

Rafał is a passionate software engineer, trainer, conference speaker, and author of the book, Continuous Delivery with Docker and Jenkins. He specializes in Java development, cloud environments, and continuous delivery. Prior to joining Hazelcast, Rafał worked with a variety of companies and scientific organizations, including Google, CERN, and AGH University of Science and Technology.

Latest Blogs

Spring Boot: Hazelcast for Session Replication

Spring Boot: Hazelcast for Session Replication

Caching with Spring Boot and Hazelcast

How to set up Hazelcast on AWS ECS

View all blogs by the author
Subscribe

Subscribe to the blog

Follow us on: