From d4cf555aea7211ecf03167cbb67e9807bbdf113c Mon Sep 17 00:00:00 2001 From: Edward Haas Date: Tue, 3 Mar 2026 10:35:50 +0200 Subject: [PATCH] docs, net, service-objects: Add a section for Service lifecycle In v1.9 `virtctl expose` adds a `ownerReference` to the Service object and binds it to the VM/VMI object. Allowing proper cleanup of Services and avoiding orphan services. Signed-off-by: Edward Haas --- docs/network/service_objects.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/network/service_objects.md b/docs/network/service_objects.md index f5f519b3f..f112a6576 100644 --- a/docs/network/service_objects.md +++ b/docs/network/service_objects.md @@ -178,3 +178,15 @@ Use `vinagre` client to connect your VirtualMachineInstance by using the public IP and port. Note that here the external port here (31829) was dynamically allocated. + +## Service lifecycle + +Service objects may be created explicitly by a user or implicitly +through the `virtctl expose` command. + +While creating the service explicitly, it is up to the user to explicitly +clean up the service. +From v1.9 the implicit service creation through `virtctl expose` adds an +[`ownerReference`](https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/) to the service object, binding the service to the VM/VMI. +As a result, the service will be collected by the k8s garbage-collector once +the referenced object (e.g. VMI) is deleted.