Difference between revisions of "Gcloud container clusters get-credentials"
Jump to navigation
Jump to search
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{lc}} | {{lc}} | ||
+ | |||
+ | [[gcloud container clusters get-credentials --help]] | ||
[[gcloud container clusters]] get-credentials | [[gcloud container clusters]] get-credentials | ||
− | [[gcloud container clusters]] get-credentials MyClusterName | + | [[gcloud container clusters]] get-credentials [[MyClusterName]] |
gcloud container clusters get-credentials MyClusterName [[--zone]] [[europe-west3-b]] | gcloud container clusters get-credentials MyClusterName [[--zone]] [[europe-west3-b]] | ||
gcloud container clusters get-credentials MyClusterName [[--region]] [[europe-west3-c]] | gcloud container clusters get-credentials MyClusterName [[--region]] [[europe-west3-c]] | ||
+ | [[gcloud container clusters]] get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region) | ||
+ | |||
+ | == Example == | ||
gcloud container clusters get-credentials MyClusterName [[--zone]] [[europe-west3-b]] | gcloud container clusters get-credentials MyClusterName [[--zone]] [[europe-west3-b]] | ||
Fetching cluster endpoint and auth data. | Fetching cluster endpoint and auth data. | ||
[[kubeconfig]] entry generated for MyClusterName. | [[kubeconfig]] entry generated for MyClusterName. | ||
+ | Use new [[contexts]] to access the cluster: | ||
[[kubectl config get-contexts]] | [[kubectl config get-contexts]] | ||
[[kubectl config use-context]] | [[kubectl config use-context]] | ||
+ | [[kubectl config current-context]] | ||
+ | |||
+ | == Errors == | ||
+ | |||
+ | [[gcloud container clusters]] get-credentials your-cluster-name --region europe-west3-b | ||
+ | Fetching cluster endpoint and auth data. | ||
+ | ERROR: (gcloud.container.clusters.get-credentials) [[ResponseError: code=403]], message=Required "[[container.clusters.get]]" permission(s) for "projects/your-project/zones/europe-west3-b/clusters/your-cluster-name". | ||
− | |||
gcloud container clusters get-credentials | gcloud container clusters get-credentials | ||
ERROR: (gcloud.container.clusters.get-credentials) argument NAME: Must be specified. | ERROR: (gcloud.container.clusters.get-credentials) argument NAME: Must be specified. | ||
Line 20: | Line 32: | ||
For detailed information on this command and its flags, run: | For detailed information on this command and its flags, run: | ||
− | gcloud container clusters get-credentials --help | + | [[gcloud container clusters get-credentials --help]] |
+ | |||
+ | |||
+ | [[gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region)]] | ||
+ | Fetching cluster endpoint and auth data. | ||
+ | ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=404, message=Not found: projects/your-project/locations/us- central1/clusters/your-cluster-co-gke. | ||
+ | Could not find [your-cluster-gke] in [us-central1]. | ||
+ | Did you mean [your-cluster-gke] in [us-central1-a]? | ||
+ | |||
+ | |||
+ | [[gcloud container clusters]] get-credentials $([[terraform output -raw kubernetes_cluster_name]]) --region $([[terraform output -raw region]]) | ||
+ | Fetching cluster endpoint and auth data. | ||
+ | WARNING: cluster your-cluster-gke is not RUNNING. The [[kubernetes API]] may or may not be available. Check the [[cluster status]] for more information. | ||
+ | [[kubeconfig]] entry generated for your-cluster-gke. | ||
== Related == | == Related == | ||
Line 27: | Line 52: | ||
* <code>[[kubectl get pods]]</code> | * <code>[[kubectl get pods]]</code> | ||
* <code>[[aws eks update-kubeconfig --name my-eks-cluster-name]]</code> | * <code>[[aws eks update-kubeconfig --name my-eks-cluster-name]]</code> | ||
+ | * <code>[[~/.kube/config]]</code> | ||
+ | * <code>[[gcloud config set account]]</code> | ||
+ | * [[Provide access to GKE cluster]] | ||
+ | * [[Connect to K8s cluster]] | ||
+ | * <code>[[kubectl config rename-context]]</code> | ||
== See also == | == See also == |
Latest revision as of 06:13, 30 November 2022
gcloud container clusters get-credentials --help gcloud container clusters get-credentials gcloud container clusters get-credentials MyClusterName gcloud container clusters get-credentials MyClusterName --zone europe-west3-b gcloud container clusters get-credentials MyClusterName --region europe-west3-c gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region)
Contents
Example[edit]
gcloud container clusters get-credentials MyClusterName --zone europe-west3-b Fetching cluster endpoint and auth data. kubeconfig entry generated for MyClusterName.
Use new contexts to access the cluster:
kubectl config get-contexts kubectl config use-context kubectl config current-context
Errors[edit]
gcloud container clusters get-credentials your-cluster-name --region europe-west3-b Fetching cluster endpoint and auth data. ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Required "container.clusters.get" permission(s) for "projects/your-project/zones/europe-west3-b/clusters/your-cluster-name".
gcloud container clusters get-credentials ERROR: (gcloud.container.clusters.get-credentials) argument NAME: Must be specified. Usage: gcloud container clusters get-credentials NAME [optional flags] optional flags may be --help | --internal-ip | --region | --zone For detailed information on this command and its flags, run: gcloud container clusters get-credentials --help
gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region) Fetching cluster endpoint and auth data. ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=404, message=Not found: projects/your-project/locations/us- central1/clusters/your-cluster-co-gke. Could not find [your-cluster-gke] in [us-central1]. Did you mean [your-cluster-gke] in [us-central1-a]?
gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region) Fetching cluster endpoint and auth data. WARNING: cluster your-cluster-gke is not RUNNING. The kubernetes API may or may not be available. Check the cluster status for more information. kubeconfig entry generated for your-cluster-gke.
Related[edit]
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters list
kubectl get pods
aws eks update-kubeconfig --name my-eks-cluster-name
~/.kube/config
gcloud config set account
- Provide access to GKE cluster
- Connect to K8s cluster
kubectl config rename-context
See also[edit]
gcloud container clusters [ create | get-credentials | list | describe ]
gcloud container [ clusters | images | get-server-config | subnets ]
- GKE, GKE Autopilot,
gcloud container, gke-gcloud-auth-plugin
, GKE release channels, GKE Ingress, GCP Node logs, GCP Node logs severity Error, GKE roles, Provide access to GKE cluster, Deploy GKE cluster using Terraform,cluster_autoscaling, addons_config, GKE Node Pool
, node auto-provisioning
Advertising: