Deploy a Cluster with the Hazelcast Platform Operator for Kubernetes
This topic explains how to deploy a Hazelcast cluster using Hazelcast Platform Operator for Kubernetes.
Prerequisites
If you want to migrate from the Hazelcast Helm Chart, please follow the guidance in Migrating from Helm document. |
Step 1. Deploy Hazelcast Platform Operator
As part of the deployment process, you will install the custom resource definitions (CRD) that describe the Hazelcast resource types.
A CRD is a Kubernetes feature that allows you to create custom resources that extend the Kubernetes API. CRDs allow new types of resources tailored to specific use cases to be created, without adding another API server. They also provide detailed reports on the configuration content of a CRD to any authorized Kubernetes API consumer. Using CRDs, you can:
-
Introduce unique objects or types into the Kubernetes cluster
-
Create platform resources on top of Kubernetes
-
Build and use platforms through self-service activity
For example, the clusterName
field in the Hazelcast CRD can be used to rename a cluster.
CRDs are expressed in YAML format, just like standard Kubernetes entities. The Kubernetes API server processes and manages CRDs the same way it does with built-in resources.
For more information about the Hazelcast Platform Operator CRD, see API types.
Install and run Operator
From release 5.6.0 onwards, you can use a Helm chart to install the Hazelcast Platform Operator.
-
Add the Hazelcast Helm Charts repository to your Helm repository list by running the following command:
-
You can either deploy the Hazelcast Platform Operator at the same time as CRDs or separately.
Since CRDs are global resources, they may need to be installed by an administrator. Run the following command to deploy the Operator and the CRDs together. By default, the Hazelcast Platform Operator watches all namespaces. Use the
watchedNamespaces
variable to update this configuration.Run the following commands to deploy the Operator and the CRDs separately. An administrator may need to do this.
After installing CRDs, install the Operator by running the following command. This operation requires only namespace-scoped permissions for
hz-system
,ns-1
andns-2
namespaces which should already exist.1 Disabling createClusterScopedResources
means that the management of resources by Operator is constrained to specified namespaces. This enhances both security and compliance.2 Disabling webhook.enabled
means that webhooks cannot be used. This is needed as the cluster-wide permissions required for webhooks conflict with our restrictions on cluster-scoped resource creation.3 Disabling enableHazelcastNodeDiscovery
means that Operator does not automatically discover nodes across all namespaces. This limits the use ofNODE_AWARE
inhighAvailabilityMode
and ofNodePort
indiscoveryServiceType
, both of which depend on broader node discovery.You can view all configuration options by running the following command: helm show values hazelcast/hazelcast-platform-operator
-
Monitor the operator logs. At this point, the Hazelcast Platform Operator should be up and running. You can check it with the command below.
Step 2. Start the Hazelcast Cluster
After installing and running the Hazelcast Platform Operator, you can create a Hazelcast cluster.
Hazelcast Enterprise requires a license key. If you don’t have a license key, you can request one from the Hazelcast website.
-
Create a Kubernetes secret to hold your license key.
For Kubernetes -
Create the
Hazelcast
custom resource file and name ithazelcast-enterprise.yaml
. -
Apply the custom resource to start the Hazelcast cluster.
-
Verify that Hazelcast cluster is up and running by checking the Hazelcast member logs.
You should see the following:
Step 3. Check that the Hazelcast Cluster is running
To check if a cluster is running, see the status
field of the Hazelcast resource.
The status can be checked using the get hazelcast
command.
You can use the following command for the long format.
The phase
field represents the current status of the cluster, and can contain any of the following values:
-
Running
: The cluster is up and running. -
Pending
: The cluster is in the process of starting. -
Failed
: An error occurred while starting the cluster.
Any additional information such as validation errors will be provided in the message
field.
The readyMembers
field represents the number of Hazelcast members that are connected to the cluster.
Next Steps
Learn how to expose Hazelcast clusters outside Kubernetes so you can connect external clients to them.