cloud-iam-manager

by WOCO-IO

Helm chartv1.6.1App 1.0.0Verified publisher

A Helm chart for cloud-iam-manager which simplify the process of GSA<->KSA binding

About this chart

cloud-iam-manager Helm Chart

This chart installs cloud-iam-manager deployment. This Helm chart simplifies the process of binding Google Service Accounts (GSA) to Kubernetes Service Accounts (KSA) in a Kubernetes environment, particularly when using Google Kubernetes Engine (GKE). The service automatically handles the necessary IAM binding between GSAs and KSAs.

Features

  • Automatically binds GSAs to KSAs using the specified GKE annotation.
  • Configurable to work in a specific Kubernetes namespace.
  • Supports Google Cloud Platform (GCP) and integrates with IAM roles.
  • Configurable resource limits, liveness, readiness probes, and more.

Chart Details

  • Chart Name: cloud-iam-manager
  • Version: 1.6.0
  • Application Version: 1.6.0
  • Home: woco-io
  • Sources: GitHub Repository
  • Maintainer: Yehoraz Levi (email, GitHub)

Installation

Prerequisites

  • A Kubernetes cluster.
  • Helm 3.x installed.
  • Terraform (optional).

Setup Required Infrastructure

this can be replaced with manual / gcloud commands as long as the GSA has the required permissions and is bound to the KSA.

# Create a Google Service Account
resource "google_service_account" "k8s_service_account" {
  account_id   = "<your-service-account-id>" # Replace with your desired service account id
  display_name = "Kubernetes Service Account for Binding"
}

# Assign the specified IAM roles to the Google Service Account
resource "google_project_iam_member" "iam_bindings" {
  for_each = toset([
    "roles/iam.serviceAccount.get",
    "roles/iam.serviceAccount.getIamPolicy",
    "roles/iam.serviceAccount.list",
    "roles/iam.serviceAccount.setIamPolicy"
  ])

  project = "<your-gcp-project-id>"  # Replace with your GCP project ID
  role    = each.value
  member  = "serviceAccount:${google_service_account.k8s_service_account.email}"
}

# Bind Google Service Account to Kubernetes Service Account 
resource "google_service_account_iam_member" "bind_gsa_to_ksa" {
  member             = "serviceAccount:<your-gcp-project-id>.svc.id.goog[<your-namespace>/<your-k8s-service-account>]" # Replace with your GCP project ID, namespace, ksa
  role               = "roles/iam.workloadIdentityUser"
  service_account_id = google_service_account.k8s_service_account.id
}

Setup Repo Info

helm repo add woco-io https://woco-io.github.io/helm-charts/
helm repo update

See helm repo for command documentation.

Install the Chart

To install the cloud-iam-manager chart, use the following Helm command:

kubectl create namespace <your-namespace>
kubectl label namespace <your-namespace> cloud-iam-manager.woco.io/enabled=true --overwrite
helm install my-cloud-iam-manager woco-io/cloud-iam-manager --version <chart-chosen-version> --namespace <your-namespace>

Uninstalling the Chart

To uninstall/delete the my-cloud-iam-manager deployment:

helm delete my-cloud-iam-manager --namespace <your-namespace>

For more details on configuration options, refer to the section below.

Values Configuration

Available Values

KeyDescriptionDefault Value
isAutomaticPermissionsWhether to automatically create service permissions (RBAC) and Kubernetes Service Account (KSA)true
app.nameName of the application.cloud-iam-manager
app.image.nameDocker image name for the service.woco.io/cloud-iam-manager
app.image.tagDocker image tag.1.0
app.image.pullPolicyImage pull policy.IfNotPresent
app.portPort for the service.5000
app.envEnvironment variables for the service. See Environment Variables section for more details.{}
labelsLabels for the resources created by this chart.{"app": "cloud-iam-manager"}
annotationsAnnotations for the resources created by this chart.{"app": "cloud-iam-manager"}
strategyDeployment strategy. Configure rolling updates and other settings.RollingUpdate
strategy.maxSurgeMaximum number of pods to be created above the desired number during a rolling update.25%
strategy.maxUnavailableMaximum number of pods that can be unavailable during a rolling update.25%
replicasNumber of replicas for the service.1
nodeSelectorNode selector for pod scheduling.{}
affinityAffinity rules for pod scheduling.{}
tolerationsTolerations for pod scheduling.{}
imagePullSecretsSecrets to use for pulling images from private registries.[]
livenessConfigurations for liveness probes. See liveness section for more details.{}
readinessConfigurations for readiness probes. See readiness section for more details.{}
resourcesResource requests and limits for the service. See resources section for more details.{}
serviceAccountNameName of the service account to be used by the pod.""
gcpServiceAccountGoogle Cloud Service Account to be used for API calls against GCP.Required
gcpProjectIdGoogle Cloud project id this application is deployed in.Required
createNamespaceWhether to create namespace for the service.false

Environment Variables

The cloud-iam-manager service can be configured through environment variables. These environment variables override the corresponding values in the application.yaml configuration file. Below are the environment variables that can be set:

Environment VariableDescriptionDefault Value
APP_SERVER_PORTPort on which the service will run.5000
APP_HEALTH_LIVE_INCLUDE_K8S_CLIENTInclude custom Kubernetes client liveness checks.true
APP_RUNNERS_POLLING_INTERVALPolling runner interval.10000
APP_CLOUD_IAM_MANAGER_NS_LABELLabel used to filter Kubernetes namespaces for the service to operate in, use "all" for all namespaces.cloud-iam-manager.woco.io/enabled=true
APP_CLOUD_IAM_MANAGER_EVENT_TIMING_MINUS_HOURSAdjust event timing (in hours) for the service.0
APP_CLOUD_IAM_MANAGER_SA_IAM_ANNOTATIONAnnotation key used to identify the Kubernetes Service Accounts to bind.iam.gke.io/gcp-service-account
APP_CLOUD_IAM_MANAGER_CLOUD_PROVIDERThe cloud provider (supports GCP).GCP
APP_CLOUD_IAM_MANAGER_IAM_BINDING_ROLEIAM role used when binding the Google Service Account to the Kubernetes Service Account.iam.workloadIdentityUser
APP_GCP_PROJECT_IDGoogle Cloud Project ID to be used for the GSA binding.placeholder-fake-value
APP_CLOUD_IAM_MANAGER_IS_PRESERVE_IAM_BINDINGSWhether to preserve IAM bindings.true
APP_IS_USE_CACHEWhether to enable cache usage.true

Custom Values

You can override the default values in the values.yaml file during installation by passing custom values via the --set flag or by providing a custom values file.

For example:

helm install my-cloud-iam-manager woco-io/cloud-iam-manager --version <chart-chosen-version> --namespace <your-namespace> --set app.name=my-app,app.image.tag=latest

Notes

  • The service requires the APP_GCP_PROJECT_ID to be set for GCP integration.
  • Ensure your Kubernetes cluster is running on GKE to take full advantage of the GSA <-> KSA binding features.
  • You can customize resource requests and limits in the values.yaml file to suit your deployment needs.

Values Schema

This chart uses a values schema to enforce valid configuration. The schema can be found in the values.schema.json file, which includes detailed descriptions of all configurable properties.

You can validate your values by running:

helm pull woco-io/cloud-iam-manager --version <chart-chosen-version> --untar
helm lint cloud-iam-manager --version <chart-chosen-version> --namespace <your-namespace> --set app.name=my-app,app.image.tag=latest

Conclusion

The cloud-iam-manager Helm chart simplifies the management of Google Kubernetes Engine (GKE) workloads by automating the process of binding Google Service Accounts to Kubernetes Service Accounts. This chart provides a customizable deployment solution that integrates easily with GCP IAM and Kubernetes RBAC.

Deploy cloud-iam-manager with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cloud-iam-manager on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcloud-iam-manager is pinned at v1.6.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply