This is in general supported by Kubernetes, at least you can do something like this and Kubernetes accepts it:
spec:
containers:
- name: test
env:
- name: VAR
value: FOO
- name: VAR
value: BAR
The VAR variable will then hold BAR.
I couldn't find something in the official Kubernetes docs that describes this behavior, but I've found this third-party article.
If a HelmRelease renders to such a resource and spec.driftDetection.mode is enabled the helm-controller will fail to reconcile the HelmRelease with this error:
- lastTransitionTime: "2025-10-08T20:00:29Z"
message: 'Could not determine release state: unable to determine cluster state:
Deployment/minecraft/togather-minecraft dry-run failed: failed to create typed
patch object (minecraft/togather-minecraft; apps/v1, Kind=Deployment): .spec.template.spec.containers[name="togather-minecraft-mc-backup"].env:
duplicate entries for key [name="BACKUP_NAME"]'
observedGeneration: 92
reason: StateError
status: "False"
type: Ready