Multi-kubernetes Service-mesh implementation through partition in Consul Service-mesh

hello
i am lee

I am implementing a service-mesh between multi-eks using the consul partition function.

I always get confused when creating exported-services cr.

First, I will show you my CR full text.

apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
  name: default 
spec:
  services:
  - name: "*"
    namespace: backend-api
    consumers:
    - partition: backend-partition  

The question here is:

  1. metadata.name β†’ default β†’ partition containing the service to be advertised
  2. spec.services.name β†’ * β†’ All Service name in the namespace of the partition to be advertised
  3. spec.services.namespace β†’ backend β†’ namespace in the partition to be advertised
  4. spec.services.consumer.partition β†’ second β†’ Partition name containing the service to be advertised

Is it possible that my understanding is correct?
I would be very grateful if you could reply.

Hi @swbs90,

Your understanding is mostly correct. I just want to clarify the purpose of the consumers key.

The consumers key lists the partitions or peers that the service should be shared with. These partitions/peers contain the downstream services that need to reach the services you are advertising.

The configuration examples on the exported services config entry reference are annotated with descriptions of each field that better explain this.

Here’s a quick example.

apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
  name: <partition containing services to export>
spec:
  services:
    - name: <name of service to export>
      namespace: <namespace in the partition containing the service to export>
      consumers:
        - partition: <name of the partition(s) toward which to advertise the service>

I hope this helps.

1 Like