Update GCE Metadata for node pool

9/3/2019

When I setup a new cluster and specific custom node pool definitions, I get to option to add GCE instance metadata. When I created my production cluster, I setup 5 node pools and each node pool had a key/value pair assigned as GCE instance metadata.

Now I need to either update that key/value pair OR add a new key/value pair but when I click on "Edit Node Pool", I dont see any option to add more GCE instance metadata.

I am well aware of the command:

gcloud compute instances add-metadata INSTANCE \
  --metadata bread=mayo,cheese=cheddar,lettuce=romaine

But this is more for an instance and not for the entire node pool.

Is there some way to do it?

I've come across commands like:

gcloud container node-pools update

But it does not have a flag to update the Metadata itself.

-- Jason Stanley
google-cloud-platform
google-compute-engine
google-kubernetes-engine

2 Answers

9/3/2019

You can only edit the clusters metadata at the cluster creation stage. In order to add metadata you will need to recreate your cluster. You can do so in the advance edit section of the cluster creation page.

This is because the Instances in a Kubernetes cluster represent nodes that are managed by the Kubernetes master.

-- Alexandre
Source: StackOverflow

9/6/2019

You cannot update the instance metadata on an existing node pool, but you don't need to recreate your entire cluster if you want to change it. You can create a new node pool with the desired instance metadata in your existing cluster, migrate your workload to the new nodes, and then delete the old node pool. Or if you don't care about your workloads pausing temporarily, delete all 5 of your node pools and recreate them with the correct instance metadata.

-- Robert Bailey
Source: StackOverflow