GKE Cluster Access Manager is a CLI tool that simplifies access management for Google Kubernetes Engine (GKE) clusters.
- List and select GCP projects
- List and select GKE clusters from the chosen project
- Easy cluster selection through interactive UI
- Automatic kubeconfig configuration
- Automatic Authorized Networks update (if enabled)
- Go 1.20 or higher
- Google Cloud SDK (gcloud)
- kubectl
- GCP account with required permissions
- Container Engine related permissions
- Cloud Resource Manager related permissions
- Clone repository
git clone https://github.com/bobphul/my-gke.git
cd my-gke
- Install packages
go mod tidy
- Build
go build -o gke
- Add executable to PATH
For local environment:
sudo mv gke /usr/local/bin/
For Google Cloud Shell:
# Create Go bin directory if it doesn't exist
mkdir -p ~/gopath/bin
# Move the executable
mv gke ~/gopath/bin/
# Add to PATH if not already added
echo 'export PATH=$PATH:~/gopath/bin' >> ~/.bashrc
source ~/.bashrc
- Configure gcloud authentication (SKIP if using Google Cloud Shell)
gcloud auth login
gcloud auth application-default login
- Run the program
gke
- Use arrow keys (↑/↓) to select projects and clusters, press Enter to confirm
- Project Selection: Displays all accessible GCP projects in your account
- Cluster Selection: Shows all GKE clusters in the selected project
- Automatic Authentication: Automatically configures kubeconfig for the selected cluster
- IP Auto-update: Automatically adds/updates the current user's IP to Authorized Networks if enabled
container.clusters.get
container.clusters.list
container.clusters.update
container.operations.get
resourcemanager.projects.get
resourcemanager.projects.list
-
If permission errors occur:
- Verify gcloud authentication is properly set up
- Check if necessary IAM permissions are granted
-
If cluster connection errors occur:
- Check Authorized Networks settings
- Verify VPC firewall rules
- IP auto-update feature is skipped if Authorized Networks is not enabled on the GKE cluster
- Private clusters may require additional network configuration
This project is licensed under the MIT License. See the LICENSE file for details.