Comment 1 for bug 1847512

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

The systemd fix commit/from LP bug 1846787 has been verified
to resolve the problem with test packages in ppa:mfo/sf219578 [1],
- no scope units are left over after the pods complete.

It's also been verified by another user on different K8s setup,
- no scope units are left over after the pods complete.

$ dpkg -s systemd | grep ^Version:
Version: 229-4ubuntu21.22+test20191008b1

With simple Pod:

$ systemctl list-units --type=scope | grep 'Kubernetes transient mount for'
$

$ kubectl create -f pod-with-secret.yaml

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
pod-with-secret 0/1 Completed 0 35s

$ systemctl list-units --type=scope | grep 'Kubernetes transient mount for'
$

$ kubectl delete pods pod-with-secret
$ kubectl create -f pod-with-secret.yaml
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
pod-with-secret 0/1 Completed 0 8s

$ systemctl list-units --type=scope | grep 'Kubernetes transient mount for'
$

$ kubectl delete pods pod-with-secret
$ kubectl create -f pod-with-secret.yaml
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
pod-with-secret 0/1 Completed 0 5s

$ systemctl list-units --type=scope | grep 'Kubernetes transient mount for'
$

$ kubectl delete pods pod-with-secret
$ kubectl create -f pod-with-secret.yaml

$ systemctl list-units --type=scope | grep 'Kubernetes transient mount for'
$

$ kubectl delete pods pod-with-secret

With CronJob:

$ kubectl create -f cronjob-with-secret.yaml
cronjob.batch/cronjob-with-secret created

< wait a few minutes >

$ kubectl get cronjobs
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
cronjob-with-secret */1 * * * * False 0 24s 5m52s

$ systemctl list-units --type=scope | grep 'Kubernetes transient mount for'
$

$ kubectl delete cronjobs cronjob-with-secret

[1] https://launchpad.net/~mfo/+archive/ubuntu/sf219578