Skip to main content

GKE Workload Identity Analyzer

This script takes a Pod name (running in the current context) and performs checks to ensure that Workload Identity is properly configured.

Performed checks

  • Workload Identity enabled on the GKE cluster
  • Pod has .spec.serviceAccountName configured
  • KSA (configured in previous step) exists
  • KSA is annotated correctly with a GSA
  • GSA (configured in previous step) exists in the project
  • KSA has roles/iam.workloadIdentityUser on the GSA
  • GSA IAM roles in the project

Supported Versions

Prerequisites

  • gcloud cli installed and configured
  • Application Default Credentials generated using gcloud
  • kubectl installed and configured with cluster access
  • current kubectl context pointing to the relevant cluster
  • python 3 and pip installed
  • if running from source, python requirements installed: pip install -r requirements.txt

Installation

This package is published to PyPI and can be installed using pip:

pip install wi-analyzer

Necessary project access

The script can be run by a user with the Viewer role in the project.

Alternatively, the user will need enough GKE cluster access to read Pods and ServiceAccounts, plus the following IAM permissions:

  • container.clusters.get
  • iam.serviceAccounts.get
  • iam.serviceAccounts.getIamPolicy
  • resourcemanager.projects.getIamPolicy

If the GSA is in a different GCP project than the GKE cluster, you'll need the last 3 permissions on that project instead.

Using the tool

$ wi-analyzer --help
usage: wi-analyzer [-h] [-n NAMESPACE] [-d] pod

GKE Workload Identity Analyzer

positional arguments:
  pod                   Kubernetes Pod name to check

options:
  -h, --help            show this help message and exit
  -n NAMESPACE, --namespace NAMESPACE
                        Kubernetes Namespace to run in
  -d, --debug           Enable debug logging

Configure your current context to point at the cluster where the workload is running. Either configure the relevant namespace for the current context or pass the namespace name using the -n flag.

Pass a pod name to check - it can be part of a Deployment, Job, StatefulSet, etc, but it has to be running already.

Metadata

Release files for wi-analyzer 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wi-analyzer 0.1.1
File Size Uploaded
wi-analyzer-0.1.1.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wi-analyzer 0.1.1
File Interpreter ABI Platform
wi_analyzer-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / wi-analyzer-0.1.1.tar.gz

Download URL wi-analyzer-0.1.1.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
669d0e07c7a1b475d0321d8413a556c7f639e39877a5e2f4ee53d6cd10cf24c9
BLAKE2b-256 checksum
How to use checksums
85ee31f7c56408eb885148fa842600a5ab8ef8e8bb4b44508b232db1bb7850ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / wi_analyzer-0.1.1-py3-none-any.whl

Download URL wi_analyzer-0.1.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25be6dc1ba836a97e80ef6adbac33ce10c4d7d837422ad0e966891a72fe91556
BLAKE2b-256 checksum
How to use checksums
4634d90cd8597581b3e2128fe4f60d0a09831ea7b483cc4ee4780459e449ef57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page