How can I access the api@internal service from within the cluster

How can I access the api@internal service endpoint from within the cluster as similar to accessing the other services? ie: using <service-name>.<namespace>.svc.cluster.local

I want to access it like curl -I http://<traefik-api>.mynamespace.svc.cluster.local without defining a ingressroute as for other external traffic.

apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: ingressroute-traefik
  namespace: prod-xxx
  annotations:
    kubernetes.io/ingress.class: ingressclass-traefik
spec:
  entryPoints:
    - https-internal
  routes:
    - kind: Rule
      match: "Host(`traefik.xxx.com`)"
      middlewares:
        - name: middleware-authentik
          namespace: prod-xxx
      services:
        - kind: TraefikService
          name: dashboard@internal

    - kind: Rule
      match: "Host(`traefik.xxx.com`) && PathPrefix(`/api`)"
      middlewares:
        - name: middleware-authentik
          namespace: prod-xxx
      services:
        - kind: TraefikService
          name: api@internal
  tls:
    certResolver: cloudflare
    domains:
    - main: "*.xxx.com"

I guess I found the solution

with api.insecure=true and not having a endpoint called traefik, api is available on port 8080 for which I can create a service object

Doc: Traefik API Documentation - Traefik

apiVersion: v1
kind: Service
metadata:
  name: service-traefik-api
  namespace: prod-xxx
spec:
  selector:
    app: deployment-traefik
  ports:
    - name: api-http-internal
      protocol: TCP
      port: 80
      targetPort: 8080

which can be accessed from within the cluster as curl http://service-traefik-api/api/overview

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.