kubectl-gke

command module
v0.0.0-...-7e19821 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 5 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL