# How to expose the APIs of multi-services through localhost with ingress in the microk8s?

**URL:** <https://discuss.kubernetes.io/t/how-to-expose-the-apis-of-multi-services-through-localhost-with-ingress-in-the-microk8s/18004>\
**Category:** microk8s\
**Created:** [November 6, 2021, 2:31pm UTC](https://discuss.kubernetes.io/t/how-to-expose-the-apis-of-multi-services-through-localhost-with-ingress-in-the-microk8s/18004 "2021-11-06T14:31:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gen0106](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@gen0106](https://discuss.kubernetes.io/u/gen0106)\
**Post date:** [November 6, 2021, 2:31pm UTC](https://discuss.kubernetes.io/t/how-to-expose-the-apis-of-multi-services-through-localhost-with-ingress-in-the-microk8s/18004/1 "2021-11-06T14:31:06Z")

</div>

I created a microservices project. auth-service, user-service, chat-service, frontend-service, and so on.  
I wanted to make this on the ubuntu20 vmware.  
So I created pods and services in the microk8s for every services.  
And I created an ingress so all APIs of the services can be called via the ingress.

This is the content of the yaml file for ingress.

```auto
apiVersion: networking.k8s.io/v1
kind: Ingress

metadata:
  name: fishapp-ingress
  labels:
    app: fishapp
  annotations:
    ingress.kubernetes.io/rewrite-target: /

spec:
  defaultBackend:    
    service: 
      name: auth-service
      port:
        number: 80
  rules:
    - http:
        paths:
          - path: /api/auth
            pathType: Prefix
            backend:
              service:
                name: auth-service
                port:
                  number: 80
          - path: /api/chat
            pathType: Prefix
            backend:
              service:
                name: chat-service
                port:
                  number: 80
          - path: /admin
            pathType: Prefix
            backend:
              service:
                name: frontend-service
                port:
                  number: 80
          - path: /api/media
            pathType: Prefix
            backend:
              service:
                name: media-service
                port:
                  number: 80
          - path: /api/store
            pathType: Prefix
            backend:
              service:
                name: store-service
                port:
                  number: 80
          - path: /api/user
            pathType: Prefix
            backend:
              service:
                name: user-service
                port:
                  number: 80
          - path: /api/checkout
            pathType: Prefix
            backend:
              service:
                name: checkout-service
                port:
                  number: 80

```

```auto
$ kubectl apply -f ingress.yaml

$ kubectl describe ing fishapp-ingress
Name: fishapp-ingress
Namespace: default
Address: 127.0.0.1
Default backend: auth-service:80 (10.1.243.223:9080)
Rules:
  Host Path Backends
  ---- ---- --------
  *           
              /api/auth auth-service:80 (10.1.243.223:9080)
              /api/chat chat-service:80 (10.1.243.224:9080)
              /admin frontend-service:80 (10.1.243.241:9080)
              /api/media media-service:80 (10.1.243.207:9080)
              /api/store store-service:80 (10.1.243.210:9080)
              /api/user user-service:80 (10.1.243.213:9080)
              /api/checkout checkout-service:80 (10.1.243.237:9080)
Annotations: ingress.kubernetes.io/rewrite-targert: /
Events: <none>

```

I can confirm that auth service’s api is working through cluster ip address.

```auto
$ curl 10.1.243.223:9080/health/ready
{"checks":[{"data":{},"name":"Auth Service Readiness Check","status":"UP"}],"status":"UP"}

```

But auth service’s api is not working through localhost

```auto
$ curl localhost/api/auth/health/ready
$

```

I want to expose APIs of multi-services through the localhost of vmware.  
Please help me.  
Thanks in advance.
