Invalid label value on K8s on GCP

4/24/2020

An earlier version of my deployment in K8s had "${PROJECT_NAME}" as a label value in preferredDuringSchedulingIgnoredDuringExecution.

I realized my mistake and the value is now changed to "api". So far so good.

The problem starts I scale my node pool to more than one node. Then I get this error:

invalid label value: "${PROJECT_NAME}": at key: "app": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')

It seems like the old value is still stored somewhere in the system. I have therefore checked all the YAML's and none have the wrong value in it anymore.

What can I do?

PS: I'm using helm for deploying those YAML's

-- Max Moeschinger
google-cloud-platform
kubernetes

1 Answer

4/24/2020

You haven't provided the details if you are redeploying your Helm charts, but it sounds like you are redeploying after the node pool is scaled and the ${PROJECT_NAME} substitution is not happening before deployment.

I would recommend finding out where ${PROJECT_NAME} is in your Helm chart and just substitute it with just api and see if that's the issue. Then go back and find out if maybe (?) you are using bash (or some shell to deploy) and ${PROJECT_NAME} is missing from your environment (?).

-- Rico
Source: StackOverflow