1

Is it possible to expose dapr side car as a service?

Enviroment: In k8s, an app is deployed with a dapr side car. I want to expose the dapr side car and get access to the side car by external ip.

Binjing666
  • 11
  • 1

1 Answers1

0

Did you try to create an ingress resource on default ApiGroup, then expose the port

https://kubernetes.io/docs/concepts/services-networking/ingress/

  • create an ingress resource
  • expose the port with host / path
  • expose side container port
  • curl to test $curl -L yourAPP.ApiGroup.URL:8080/dapr-sidecontainer
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dapr-ingress
spec:
  rules:
  - host: yourAPP.ApiGroup.URL
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: yourAPP
            port:
              number: 8080 # expose port
---
kind: Service
metadata:
   label:
     app: yourAPP
   name: yourAPP
spec:
   containers:
     -name: main-container
     ....
     -name: dapr-sidecontainer
      port: 8080 # port exposed to outside
      targetPort: 80 # targeted from outside
Enis Bilgin
  • 86
  • 1
  • 3