Kubernetes Deployment - Invalid Label

Hi All,

Been trying to deploy my container to Azure Kubernetes service, and keep getting this error

The Deployment "edi-transmission" is invalid:  
* spec.template.metadata.labels: Invalid value: map[string]string{"Octopus.Kubernetes.DeploymentName":"edi-transmission", "Octopus.Step.Id":"ff591ede-7699-4f83-89f5-ea5e5f757070", "Octopus.Deployment.Tenant.Id":"untenanted", "Octopus.Environment.Id":"environments-441", "Octopus.Deployment.Id":"deployments-22732"}: `selector` does not match template `labels` 
* spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"edi-transmission", "Octopus.Kubernetes.DeploymentName":"edi-transmission"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable 

Can’t decipher that that error is about, any ideas?

Hi @sireza, thanks for reaching out.

The issue here appears to be that an existing deployment resource is attempting to be updated with new selector labels. These can’t be changed once the deployment resource has been created, which is why you get the error field is immutable.

What was the process that you went through that resulted in this error? Were you using the Kubernetes steps in Octopus, or were these deployments build manually?

Matt C

That was it! I did a manual deployment (via cli) prior trying with Octopus, and was using the same deployment.

Thank you