Answers: <p>First make sure the desired cluster is available to you</p>
  <pre><code>gcloud container clusters list
  </code></pre>
  <p>Now you need to reconcile that command (which has the data from Google) with your local kubectl, you can do that with</p>
  <pre><code>kubectl config get-contexts
  </code></pre>
  <p>If you do not see a matching context, you can add one. The following command adds the context and sets it as the current-context, which is weird for a command called &quot;get-credentials&quot; but that's Google.</p>
  <pre><code>gcloud container clusters get-credentials myCluster --region=us-central1
  </code></pre>
  <p>But, if there is already a context in your kubectl that you merely want to switch to you can do that with</p>
  <pre><code>kubectl config use-context myContext
  </code></pre>
  <hr />
  <p>For more information see this link</p>
  <ul>
  <li><a href="https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl</a></li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2023-04-12T22:36:30.567Z
Answers: 2023-04-12T22:36:30.567Z
Answers: Evan Carroll
Body: <p>Currently helm is installing to the wrong cluster on GKE, how can I install to a different cluster?</p>
  
Comments: CC BY-SA 4.0
Comments: 2023-04-13T05:55:11.093Z
Comments: What details or clarity does this need? it's self answered.
Comments: Evan Carroll
Tags: <kubectl><google-kubernetes-engine><gcloud>
Title: How can I change the context of kubectl commands and helm?
UserDisplayName: Evan Carroll
ThreadText: # How can I change the context of kubectl commands and helm?
  
  (Asked by: username_0 on 2023-04-12)
  
  Currently helm is installing to the wrong cluster on GKE, how can I install to a different cluster?
  
  **Tags:** kubectl, google-kubernetes-engine, gcloud
  
  > **Comments:**
  > **username_0**: What details or clarity does this need? it's self answered.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-04-12. Score: 1 | Accepted answer
  
  First make sure the desired cluster is available to you
  
  ```
  gcloud container clusters list
  
  ```
  
  Now you need to reconcile that command (which has the data from Google) with your local kubectl, you can do that with
  
  ```
  kubectl config get-contexts
  
  ```
  
  If you do not see a matching context, you can add one. The following command adds the context and sets it as the current-context, which is weird for a command called "get-credentials" but that's Google.
  
  ```
  gcloud container clusters get-credentials myCluster --region=us-central1
  
  ```
  
  But, if there is already a context in your kubectl that you merely want to switch to you can do that with
  
  ```
  kubectl config use-context myContext
  
  ```
  
  ---
  
  For more information see this link
  
  * <https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl>
  
  
  ---
  
  