Install Harness Delegate on Google Kubernetes Engine (GKE) With Workload Identity
Workload Identity allows a Kubernetes service account in your GKE cluster to act as a Google IAM Service account. Pods that use the configured KSA automatically authenticate as the IAM service account when accessing Google Cloud APIs.
To learn more about Workload Identity check out the blog that explains it with an example.
At the end of this tutorial you will know how to:
- Enable Workload Identity on GKE.
- Deploy Harness Delegate onto Workload Identity-enabled GKE.
- Build a simple CI pipeline to push the image to Google Artifact Registry without using GCP connectors or configuring secrets.
CI pipeline scenario
- Build a Go application. You can build any application, but Go is used as an example here.
- Package the application build artifact as a container image.
- Push the image to Google Artifact Registry (GAR).
- Cache the build artifacts and dependencies (Go modules) onto Google Cloud Storage(GCS) to make the build process faster.
Glossary
Review the following terms and their abbreviations.
Abbreviation | Meaning |
---|---|
API | Application Programming Interface |
ACL | Access Control List |
GAR | Google Artifact Registry |
GCS | Google Cloud Storage |
GKE | Google Kubernetes Engine |
GSA | Google Service Account |
IAM | Identity and Access Management |
KSA | Kubernetes Service Account |
RBAC | Role-based Access Control |
SA | Service Account |
VPC | Virtual Private Cloud |
Pre-requisites
- A Google Cloud Account with a Service Account with the following roles:
Kubernetes Engine Admin
to create a GKE clusterService Account
roles used to create, update, or delete a Service Account- iam.serviceAccounts.actAs
- iam.serviceAccounts.get
- iam.serviceAccounts.create
- iam.serviceAccounts.delete
- iam.serviceAccounts.update
- iam.serviceAccounts.get
- iam.serviceAccounts.getIamPolicy
- iam.serviceAccounts.setIamPolicy
- (OR) simply you can add
Service Account Admin
andService Account User
roles
Compute Network Admin
to create the VPC networks
Required tools
Download and install the following tools locally onto your laptop:
Download sources
As we will be using Terraform pipelines to deploy GKE and Harness Delegate, clone the sources locally:
git clone https://github.com/harness-apps/workload-identity-gke-demo.git && cd "$(basename "$_" .git)"
export DEMO_HOME="$PWD"