Set up a Google Kubernetes Engine (GKE) cluster

Set up a Google Kubernetes Engine cluster

Prerequisites

Create a new cluster

Create a GKE cluster by running the following:

  1. $ gcloud services enable container.googleapis.com && \
  2. gcloud container clusters create $CLUSTER_NAME \
  3. --zone $ZONE \
  4. --project $PROJECT_ID

For more options:

Sidecar injection for private GKE clusters

Sidecar injection for private clusters requires extra steps.

In private GKE clusters, an automatically created firewall rule for master access doesn’t open port 4000, which Dapr needs for sidecar injection.

Review the relevant firewall rule:

  1. $ gcloud compute firewall-rules list --filter="name~gke-${CLUSTER_NAME}-[0-9a-z]*-master"

Replace the existing rule and allow Kubernetes master access to port 4000:

  1. $ gcloud compute firewall-rules update <firewall-rule-name> --allow tcp:10250,tcp:443,tcp:4000

Retrieve your credentials for kubectl

Run the following command to retrieve your credentials:

  1. $ gcloud container clusters get-credentials $CLUSTER_NAME \
  2. --zone $ZONE \
  3. --project $PROJECT_ID

Install Helm v3 (optional)

If you are using Helm, install the Helm v3 client.

Important

The latest Dapr Helm chart no longer supports Helm v2. Migrate from Helm v2 to Helm v3.

Troubleshooting

Kubernetes dashboard permissions

Let’s say you receive an error message similar to the following:

  1. configmaps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list configmaps in the namespace "default"

Execute this command:

  1. kubectl create clusterrolebinding kubernetes-dashboard -n kube-system --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

Last modified October 12, 2023: Update config.toml (#3826) (0ffc2e7)