gcloud beta container clusters get-credentials

NAME
gcloud beta container clusters get-credentials - fetch credentials for a running cluster
SYNOPSIS
gcloud beta container clusters get-credentialsNAME[--dns-endpoint][--internal-ip][--location=LOCATION    |--region=REGION    |--zone=ZONE,-zZONE][GCLOUD_WIDE_FLAG]
DESCRIPTION
(BETA) gcloud beta container clusters get-credentials updates akubeconfig file with appropriate credentials and endpointinformation to pointkubectl at a specific cluster in GoogleKubernetes Engine.

It takes a project and a zone as parameters, passed through by set defaults orflags. By default, credentials are written toHOME/.kube/config.You can provide an alternate path by setting theKUBECONFIGenvironment variable. IfKUBECONFIG contains multiple paths, thefirst one is used.

This command enables switching to a specific cluster, when working with multipleclusters. It can also be used to access a previously created cluster from a newworkstation.

By default, gcloud beta container clusters get-credentials will configurekubectl to automatically refresh its credentials using the same identity asgcloud. If you are running kubectl as part of an application, it is recommendedto useapplicationdefault credentials. To configure akubeconfig file to useapplication default credentials, set thecontainer/use_application_default_credentialsCloud SDK property totrue before running gcloud beta container clusters get-credentials

Seehttps://cloud.google.com/kubernetes-engine/docs/kubectlfor kubectl documentation.

EXAMPLES
To switch to working on your cluster 'sample-cluster', run:
gcloudbetacontainerclustersget-credentialssample-cluster--location=us-central1-f
POSITIONAL ARGUMENTS
NAME
Name of the cluster to get credentials for. Overrides the defaultcontainer/cluster property value for this command invocation.
FLAGS
--dns-endpoint
Whether to use the DNS-based endpoint for the cluster address.
--internal-ip
Whether to use the internal IP address of the cluster endpoint.
At most one of these can be specified:
--location=LOCATION
Compute zone or region (e.g. us-central1-a or us-central1) for the cluster.Overrides the default compute/region or compute/zone value for this commandinvocation. Prefer using this flag over the --region or --zone flags.
--region=REGION
Compute region (e.g. us-central1) for a regional cluster. Overrides the defaultcompute/region property value for this command invocation.
--zone=ZONE,-zZONE
Compute zone (e.g. us-central1-a) for a zonal cluster. Overrides the defaultcompute/zone property value for this command invocation.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudcontainerclustersget-credentials
gcloudalphacontainerclustersget-credentials

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.