-
Notifications
You must be signed in to change notification settings - Fork 260
Description
Is this a request for help?:
Yes
Is this an ISSUE or FEATURE REQUEST? (choose one):
ISSUE
Which release version?:
1.0.28
Which component (CNI/IPAM/CNM/CNS):
NPM
Which Operating System (Linux/Windows):
Linux
For Linux: Include Distro and kernel version using "uname -a"
Linux aks-agentpool-34239724-1 4.15.0-1059-azure #64-Ubuntu SMP Fri Sep 13 17:02:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Which Orchestrator and version (e.g. Kubernetes, Docker)
Kubernetes
What happened:
Pods that go to a completed state before being deleted are not removed from the relevant ipset.
This eventually causes incorrect network policy/firewall rules to be applied when an unrelated pod happens to re-use the ipaddress of the completed pod.
What you expected to happen:
A pod that goes to a completed state should be removed from all of the ipsets that it belongs to, similar to when it is deleted.
How to reproduce it (as minimally and precisely as possible):
Create a Job and delete some time after completion. e.g.
apiVersion: batch/v1
kind: Job
metadata:
name: hello-world
spec:
template:
spec:
containers:
- name: pi
image: perl
command: ["perl", "-e", "print 'hello world...'; sleep 30; print 'goodbye world';"]
restartPolicy: Never
Observe the logs of one of the azure-npm pods and note that the pod creation is logged but no deletion event is ever recorded. As you might expect, this is also reflected in the underlying ipsets used by the firewall rules.
Anything else we need to know:
I think the problem is in npm/pod.go where the UpdatePod function should handle the pod going into a Succeeded or Failed state. Currently any pod in those states is ignored.