Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
320 views
in Technique[技术] by (71.8m points)

kubernetes - Override deployd Helm-chart values on GKE with values from a file in the local machine?

I would like to change my deployed(GKE) Helm Chart values file with the ones that are inside my local file, basically to do this:

helm upgrade -f new-values.yml {release name} {package name or path}

So I've make all the changes inside my local file, but the deployment is inside the GKE cluster. I've connected to my cluster via ssh, but how can I run the above command in order to perform the update if the file with the new values is on my local machine and the deployment is inside GKE cluster? Maybe somehow via the scp command?

question from:https://stackoverflow.com/questions/65892505/override-deployd-helm-chart-values-on-gke-with-values-from-a-file-in-the-local-m

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Solution by setting up required tools locally (you need a while or two for that)

You just need to reconfigure your kubectl client, which can be done pretty straighforward. When you log in to GCP Console -> go to Kubernetes Engine -> Clusters -> click on Actions (3 vertical dots to the right of the cluster name) -> select Connect -> copy the command, which may resemble the following one:

gcloud container clusters get-credentials my-gke-cluster --zone europe-west4-c --project my-project

It assumes you have your Cloud SDK and kubectl already installed on your local machine. If you have not, here you have step-by-step description how to do that:

Once you run the above command on your local machine, your kubectl context will be automatically set to your GKE Cluster even if it was set before e.g. to your local Minikube instance. You can check it by running:

kubectl config current-context

OK, almost done. Did I also mention helm ? Well, you will also need it. So if you have not installed it on your local machine previously, please do it now:

Alternative slution using Cloud Shell (much quicker)

If installing and configuring it locally seems to you too much hassle, you can simply use a Cloud Shell (I bet you've used it before). In case you didn't, once logged in to your GCP Console click on the following icon:

enter image description here

Once logged into Cloud Shell, you can choose to upload your local files there:

simply click on More (3 dots again):

enter image description here

and choose Upload a file:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...