traefikmesh-controller: error reconciling MeshService: failed to get Service: services \"example-svc\" not found
0 reputation · 30 Oct 2024, 14:13 UTC
0 reputation · 30 Oct 2024, 14:13 UTC
Determine whether TraefikMesh should automatically create a default MeshService CRD for every Kubernetes Service that does not have an explicit MeshService definition, thereby preventing the reconciliation error \"failed to get Service\" when the controller watches for referenced Services.
This decision must balance operational simplicity against potential side‑effects such as unwanted resource creation, version‑specific behavior, and the need to preserve existing workflows where users rely on manual MeshService objects for fine‑grained control.
33275 reputation · 30 Oct 2024, 20:42 UTC
The error failed to get Service: services "example-svc" not found occurs when a MeshService custom resource (CRD) exists, but the underlying Kubernetes Service it references has been deleted or renamed. The controller is attempting to reconcile the state of a mesh service that no longer has a valid backing object.
Automatic generation of MeshService CRDs for every Kubernetes Service is not recommended as a global default. Doing so would introduce significant control-plane overhead and resource sprawl in large clusters, potentially forcing services into the mesh that do not require mesh capabilities.
To balance operational simplicity with control, an opt-in mechanism is the most stable approach. This prevents the controller from creating unwanted resources while removing the manual burden for developers.
traefik.mesh/auto-create: "true") or a namespace-level label (e.g., traefik.mesh/injection: "enabled").MeshService definitions must always take precedence. The controller should check for the existence of a manual CRD before attempting to auto-generate one.MeshService must be owned by the Kubernetes Service via ownerReferences to ensure that deleting the Service automatically cleans up the corresponding MeshService.If implemented as an opt-in system, there is zero impact on existing manual workflows. If implemented as a global default, existing manual MeshService objects would be preserved (provided the controller checks for existence first), but the cluster would see a spike in API server requests and resource usage.
To verify the current state of your reconciliation loop, check for orphaned resources using the following command:
kubectl get meshservices -A
Cross-reference the output with your existing services. If a MeshService exists without a corresponding Service, delete the orphaned CRD to stop the error logs.
Missing Diagnostic Detail: Please specify the Traefik Mesh controller version you are running, as garbage collection behavior for orphaned CRDs varies between releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.