Skip to content

fix(k8s): the pyroscope Service alias collides with the pyroscope Helm release's own Service, so a fresh deploy-stack can't install Pyroscope #1104

Closed

Description

@dan-petty

Problem

k8s/monitoring/service-aliases.yaml:61-75 (added by #977, PR #978, in v0.2.25) declares Service/monitoring/pyroscope as a plain manifest. The grafana/pyroscope release that devops k8s deploy-stack --stack infra installs (stack_lifecycle.py:110-113) creates a Service with the same name. On a cluster where that Service doesn't exist yet, such as the devcontainer's fresh minikube, the alias is applied first, and Helm then refuses to install Pyroscope: the Service has no Helm ownership metadata. Found by the Copilot review of release PR #1089 (thread PRRT_kwDOThbRVc6orUOX).

On homelab-k3s, the live pyroscope Service is owned by the pyroscope Helm release (revision 9), so nothing fails there today. Applying the alias manifest still edits a Helm-owned object.

Acceptance criteria

  • The pyroscope alias is removed. Every consumer (Grafana's Pyroscope datasource, port-forward targets, dashboards, docs) uses the chart's own pyroscope Service.
  • A test fails when any manifest outside a Helm chart declares a Service that a release in _HELM_RELEASES_BY_STACK creates under the same name and namespace. That catches the next alias of this kind.
  • Pending a person: on a fresh minikube, uv run devops k8s deploy-stack --stack infra installs Pyroscope.

Strategic alignment

Consolidated from #818 (with the monitoring audit's widening)

Problem (added). The pyroscope alias is one of four alias Services in k8s/monitoring/service-aliases.yaml: prometheus, kube-prometheus-kube-prome-prometheus, kube-prometheus-grafana and pyroscope. Since #912 the root kustomization (k8s/kustomization.yaml:8-10) puts the file into the kustomize base, and deploy-stack applies that base before any Helm release. So #818's line "deploy-stack never applies that file" is stale. At 14e5da1 the CLI still looks up the kube-prometheus names:

  • commands/k8s/networking.py:378-381 (configure-urls);
  • :496-500 and :702 (the prome-prometheus fragment, the only pattern for prometheus.url's ingress lookup, which can never match);
  • :952-955 (port-forward);
  • k8s/credentials.py:170 (kube-prometheus-stack-grafana first);
  • k8s/service_proxy.py:314, tests/test_k8s_proxy_addressing.py:48-68 and tests/test_k8s_bootstrap.py:353-354.

The prometheus alias duplicates the chart's prometheus-server Service (monitoring audit, 2026-10-03). service-aliases.yaml:4-16 (#912) declares Service prometheus with selector name=prometheus, component=server and no app.kubernetes.io/instance pin. kube-prometheus-kube-prome-prometheus has the same selector. Only the chart's prometheus-server pins instance=prometheus, and it already listens on 9090 (k8s/monitoring/prometheus-values.yaml:30-31). All three resolve to the one server pod today; prometheus-values.yaml:274-275 and :324-325 record a second Prometheus scraped on 2026-10-01/02, which an unpinned selector would have joined. Consumers of the alias:

  • k8s/monitoring/k8s-monitoring-values.yaml:12 (destinations.localPrometheus);
  • k8s/monitoring/grafana-values.yaml:51 (datasource);
  • k8s/ingress/ingress-routes.yaml:162 (prometheus-ingress backend);
  • src/devops_cli/crypto/tls_certificates.py:338 (prometheus.monitoring.svc SAN);
  • networking.py:378-382, which falls back to prometheus and never looks up prometheus-server.

Objects left by kube-prometheus-stack on the live cluster, with no Helm release or operator behind them (checked 2026-10-03; metadata only):

  • Secret monitoring/kube-prometheus-kube-prome-admission, created 2026-08-19;
  • Service and Endpoints kube-system/kube-prometheus-kube-prome-kubelet (labels managed-by=prometheus-operator, k8s-app=kubelet; no selector), whose mirrored EndpointSlice still lists every node's address.

Argo CD's prune (#755) deletes only objects that carry its tracking label, so it will never remove these.

Acceptance criteria (added).

  • k8s/monitoring/service-aliases.yaml is deleted, along with its entry and comment in k8s/kustomization.yaml:8-10 and its lines in k8s/README.md (:407, :410).
  • Every consumer of the prometheus alias points at prometheus-server.monitoring.svc.cluster.local:9090: Alloy's localPrometheus destination URL (.../api/v1/write), the Grafana Prometheus datasource, prometheus-ingress's backend, the TLS SAN list, and port-forward/configure-urls (svc/prometheus-server, svc/grafana port 80). git grep -n 'prometheus\.monitoring\.svc' -- k8s src tests prints nothing.
  • server.fullnameOverride: prometheus is not used. In chart 29.35.0 it also renames the server Deployment and the prometheus-server PVC, which would orphan 30 days of TSDB data and break the rules that select persistentvolumeclaim="prometheus-server" (prometheus-values.yaml:277, 302).
  • The guard test above is computed from the repo alone. No Service in the kustomize base, or in any plain manifest that deploy-stack applies, sits in a namespace that a release in _HELM_RELEASES_BY_STACK installs into, unless an exemption names its owner. The test renders no chart and keeps no hand-written list of chart Service names.
  • From chore(k8s): drop the kube-prometheus-stack service aliases #818: rg -n 'kube-prometheus|prome-prometheus' k8s src tests finds only the upstream dotdc dashboard descriptions and the historical note in tests/test_k8s_monitoring_alerting.py:274.
  • From chore(k8s): drop the kube-prometheus-stack service aliases #818: configure-urls resolves the grafana Service and the Prometheus server Service. A test with a Prometheus ingress whose backend is the Prometheus server Service sets prometheus.url to that ingress's host.
  • From chore(k8s): drop the kube-prometheus-stack service aliases #818: fetch_grafana_password finds the password in the grafana secret, and kube-prometheus-stack-grafana is no longer a candidate.
  • From chore(k8s): drop the kube-prometheus-stack service aliases #818: port-forward targets svc/grafana and svc/prometheus-server. Test fixtures and docstrings name the Services the current charts create.
  • Done on 2026-10-08, by an agent after a server-side dry run, with the owner's go-ahead. The Endpoints went with their Service:
    kubectl delete secret -n monitoring kube-prometheus-kube-prome-admission
    kubectl delete service,endpoints -n kube-system kube-prometheus-kube-prome-kubelet
    
    Before the deletion, Prometheus showed these Services only as kube_service_info rows from kube-state-metrics, with no scrape job using them. No admission webhook configuration was left behind.
  • Pending a person, or an agent showing a diff first, once after the deploy (kubectl apply -k does not prune):
    kubectl delete service -n monitoring prometheus kube-prometheus-kube-prome-prometheus kube-prometheus-grafana
    
    Expected: kubectl get svc -n monitoring lists only chart-owned Services, and kubectl get endpointslices -n kube-system | grep kube-prome prints nothing.
  • Folded in on 2026-10-08: the homelab AppProject (k8s/argocd/apps/projects.yaml) lists {group: argoproj.io, kind: AppProject, name: default} under orphanedResources.ignore.
    • Argo CD creates the default project itself, so no Application tracks it. Today it is the only orphan behind the OrphanedResourceWarning on the argocd and base Applications.
    • A file-only test asserts the entry.
    • Pending a person, after Argo CD syncs the project: kubectl -n argocd get applications -o json shows no OrphanedResourceWarning condition on any Application. On 2026-10-08, after the cleanup above and fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548's Fluent Bit uninstall, only argocd and base still had one.
  • Tests never touch the network or a cluster. changelog.d/1104.md records the change. uv run devops ci passes.

Key questions (added).

Constraint (from #818). The upstream text "Made for kube-prometheus-stack" in the dotdc dashboard descriptions stays. CHANGELOG history is not rewritten.

Placement and grouping. This item stays P1 in the backlog (#818 was P2). Effort goes from Low to Low-Medium. It is a child of #1128 (monitoring cleanup), which carries no separate alias item. Related: #794, #913, #795, #408 (leftover detection), #1031 (moves the service-name constants), #1111 (tests/test_k8s_proxy_addressing.py:54; whichever lands second adopts the other's value).

Update 2026-10-08: refinement

The title's bug is fixed: #1281 deleted the pyroscope alias. Left: the three other aliases and the lookups (commands/k8s/networking.py:378-381, :490-494, :946-949; k8s/credentials.py:169). Suggested title: fix(k8s): the monitoring alias Services and the kube-prometheus lookups are removed, and every consumer uses the charts' own Services. The base Application prunes tracked aliases from main.

Activity

  1. added
    type/bug
    scope/k8s
    priority/p1-high
    on Oct 3, 2026
  2. added this to the v0.2.34 milestone on Oct 10, 2026
  3. dan-petty-bot commented on Oct 10, 2026

    @dan-petty-bot
    Collaborator

    Moved to v0.2.34: v0.2.34 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)

  4. dan-petty commented on Oct 11, 2026

    @dan-petty
    OwnerAuthor

    Merged

  5. added a commit that references this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/k8stype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions