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

**URL:** <https://community.traefik.io/t/how-can-i-access-the-api-internal-service-from-within-the-cluster/24898>\
**Category:** Traefik v3 (latest)\
**Tags:** dashboard-api\
**Created:** [October 25, 2024, 3:04am UTC](https://community.traefik.io/t/how-can-i-access-the-api-internal-service-from-within-the-cluster/24898 "2024-10-25T03:04:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kushan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kushan/32/9458_2.png) [@Kushan](https://community.traefik.io/u/Kushan)\
**Post date:** [October 25, 2024, 3:04am UTC](https://community.traefik.io/t/how-can-i-access-the-api-internal-service-from-within-the-cluster/24898/1 "2024-10-25T03:04:57Z")

</div>

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.

```auto
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"

```

---

<div class="post-metadata">

**Author:** ![Kushan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kushan/32/9458_2.png) [@Kushan](https://community.traefik.io/u/Kushan)\
**Post date:** [October 25, 2024, 12:26pm UTC](https://community.traefik.io/t/how-can-i-access-the-api-internal-service-from-within-the-cluster/24898/2 "2024-10-25T12:26:34Z")

</div>

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](https://doc.traefik.io/traefik/operations/api/)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/2/284be0062a74f1f27851445755324fd52dc0634a.png)

```auto
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`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [October 28, 2024, 12:26pm UTC](https://community.traefik.io/t/how-can-i-access-the-api-internal-service-from-within-the-cluster/24898/3 "2024-10-28T12:26:40Z")

</div>

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