Skip to main content

Preparing Kubernetes resources

For a fully functional Pulsar cluster, you will need a few resources before deploying the Apache Pulsar Helm chart. The following provides instructions to prepare the Kubernetes cluster before deploying the Pulsar Helm chart.

Google Kubernetes Engine​

To get started easier, a script is provided to automate the cluster creation. Alternatively, a cluster can be created manually as well.

Manual cluster creation​

To provision a Kubernetes cluster manually, follow the GKE instructions.

Alternatively you can use the instructions below to provision a GKE cluster as needed.

Scripted cluster creation​

A bootstrap script has been created to automate much of the setup process for users on GCP/GKE.

The script will:

  1. Create a new GKE cluster.
  2. Allow the cluster to modify DNS records.
  3. Setup kubectl, and connect it to the cluster.

Google Cloud SDK is a dependency of this script, so make sure it's set up correctly in order for the script to work.

The script reads various parameters from environment variables and an argument up or down for bootstrap and clean-up respectively.

The table below describes all variables.

VariableDescriptionDefault value
PROJECTThe ID of your GCP projectNo defaults, required to be set.
CLUSTER_NAMEName of the GKE clusterpulsar-dev
CONFDIRConfiguration directory to store kubernetes configDefaults to ${HOME}/.config/streamnative
INT_NETWORKThe IP space to use within this clusterdefault
LOCAL_SSD_COUNTThe number of local SSD countsDefaults to 4
MACHINE_TYPEThe type of machine to use for nodesn1-standard-4
NUM_NODESThe number of nodes to be created in each of the cluster's zones4
PREEMPTIBLECreate nodes using preemptible VM instances in the new cluster.false
REGIONCompute region for the clusterus-east1
USE_LOCAL_SSDFlag to create a cluster with local SSDsDefaults to false
ZONECompute zone for the clusterus-east1-b
ZONE_EXTENSIONThe extension (a, b, c) of the zone name of the clusterb
EXTRA_CREATE_ARGSExtra arguments passed to create command

Run the script, by passing in your desired parameters. It can work with the default parameters except for PROJECT which is required:


PROJECT=<gcloud project id> scripts/pulsar/gke_bootstrap_script.sh up

The script can also be used to clean up the created GKE resources:


PROJECT=<gcloud project id> scripts/pulsar/gke_bootstrap_script.sh down

Create a cluster with local SSDs​

If you are planning to install the Pulsar Helm chart using local persistent volumes, you need to create a GKE cluster with local SSDs. You can do so using the provided script by specifying USE_LOCAL_SSD to be true. A sample command is listed as below:


PROJECT=<gcloud project id> USE_LOCAL_SSD=true LOCAL_SSD_COUNT=<local-ssd-count> scripts/pulsar/gke_bootstrap_script.sh up

Next Steps​

Continue with the installation of the chart once you have the cluster up and running.