Skip to content

A kubectl plugin that replaces the get-credentials part of gcloud, allowing for more choice while avoiding annoyances such as changing the current context when adding new contexts.

License

Notifications You must be signed in to change notification settings

fsommar/kubectl-gke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubectl gke

This kubectl plugin effectively replaces the gcloud container clusters get-credentials command, allowing for more choice while avoiding annoyances such as changing the current context when adding new contexts. It also uses its own authentication mechanism for kubectl, removing the dependency on gcloud altogether.

Why would I use this plugin?

  • Do you have a lot of GKE clusters in the same Google Cloud Platform project?
  • Do you dislike the verbosity of the Kubernetes contexts generated by gcloud?
  • Do you want to update your cluster details independent of your contexts?
  • Do you switch between contexts often, and are encumbered by gcloud having to fetch new credentials each time?

If your answer is yes to either of those questions, kubectl gke might be for you!

Example usage

kubectl gke get-credentials $PROJECT \
    --selector env=production,tier!=foo \
    --format '{{ .Cluster.Name }}'

or equivalently

kubectl gke get-credentials $PROJECT -lenv=production,tier!=foo -f'{{ .Cluster.Name }}'

or equivalently

export KUBECTL_GKE_CONTEXT_FORMAT='{{ .Cluster.Name }}'
kubectl gke get-credentials $PROJECT -lenv=production,tier!=foo

Installation

Using Go 1.16:

go install github.com/fsommar/kubectl-gke@latest

To verify that it's working as expected, run kubectl gke --help.

About

A kubectl plugin that replaces the get-credentials part of gcloud, allowing for more choice while avoiding annoyances such as changing the current context when adding new contexts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages