Closed
Description
What happened?
Consider the following deployment spec:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
env:
- name: TEST
value: "test"
- name: TEST2
value: "test2"
- name: TEST
value: "test"
Notice that there is a duplicate env entry TEST
. We realize it is duplicate so we remove one and update the container spec to be
- name: nginx
image: nginx:1.14.2
env:
- name: TEST
value: "test"
- name: TEST2
value: "test2"
And then kubectl apply
the updated deployment spec. What happens is that the env TEST
is no longer there in the newly created container.
What did you expect to happen?
I expected the env entry TEST
to be present in the container.
How can we reproduce it (as minimally and precisely as possible)?
Apply the intital deployment spec, then remove one of the duplicate entries then re-apply.
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.3", GitCommit:"ca643a4d1f7bfe34773c74f79527be4afd95bf39", GitTreeState:"clean", BuildDate:"2021-07-15T21:04:39Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.3", GitCommit:"ca643a4d1f7bfe34773c74f79527be4afd95bf39", GitTreeState:"clean", BuildDate:"2021-07-15T23:45:37Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider
Azure - AKS engine cluster.
OS version
# On Linux:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
</details>
### Install tools
<details>
</details>
### Container runtime (CRI) and and version (if applicable)
<details>
containerd 1.4.6
</details>
### Related plugins (CNI, CSI, ...) and versions (if applicable)
<details>
</details>