<p>From the consul-k8s <a href="https://www.consul.io/docs/platform/k8s/service-sync.html" rel="nofollow noreferrer">document</a>：
<strong>The Consul server cluster can run either in or out of a Kubernetes cluster. 
The Consul server cluster does not need to be running on the same machine or same platform as the sync process. 
The sync process needs to be configured with the address to the Consul cluster as well as any additional access information such as ACL tokens.</strong></p>

<p>The consul cluster I am trying to sync is <strong>outside the k8s cluster</strong>, based on the document, I must pass the address to consul cluster for sync process.However, the helm chart for installing the sync process didn’t contains any value to configure the consul cluster ip address.</p>

<pre><code>syncCatalog: 

  # True if you want to enable the catalog sync. "-" for default. 

  enabled: false 

  image: null 

  default: true # true will sync by default, otherwise requires annotation 



  # toConsul and toK8S control whether syncing is enabled to Consul or K8S 

  # as a destination. If both of these are disabled, the sync will do nothing. 

  toConsul: true 

  toK8S: true 



  # k8sPrefix is the service prefix to prepend to services before registering 

  # with Kubernetes. For example "consul-" will register all services 

  # prepended with "consul-". (Consul -&gt; Kubernetes sync) 

  k8sPrefix: null 



  # consulPrefix is the service prefix which preprends itself 

  # to Kubernetes services registered within Consul 

  # For example, "k8s-" will register all services peprended with "k8s-". 

  # (Kubernetes -&gt; Consul sync) 

  consulPrefix: null 



  # k8sTag is an optional tag that is applied to all of the Kubernetes services 

  # that are synced into Consul. If nothing is set, defaults to "k8s". 

  # (Kubernetes -&gt; Consul sync) 

  k8sTag: null 



  # syncClusterIPServices syncs services of the ClusterIP type, which may 

  # or may not be broadly accessible depending on your Kubernetes cluster. 

  # Set this to false to skip syncing ClusterIP services. 

  syncClusterIPServices: true 



  # nodePortSyncType configures the type of syncing that happens for NodePort 

  # services. The valid options are: ExternalOnly, InternalOnly, ExternalFirst. 

  # - ExternalOnly will only use a node's ExternalIP address for the sync 

  # - InternalOnly use's the node's InternalIP address 

  # - ExternalFirst will preferentially use the node's ExternalIP address, but 

  #   if it doesn't exist, it will use the node's InternalIP address instead. 

  nodePortSyncType: ExternalFirst 



  # aclSyncToken refers to a Kubernetes secret that you have created that contains 

  # an ACL token for your Consul cluster which allows the sync process the correct 

  # permissions. This is only needed if ACLs are enabled on the Consul cluster. 

  aclSyncToken: 

    secretName: null 

    secretKey: null 



  # nodeSelector labels for syncCatalog pod assignment, formatted as a muli-line string. 

  # ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector 

  # Example: 

  # nodeSelector: | 

  #   beta.kubernetes.io/arch: amd64 

  nodeSelector: null
</code></pre>

<p>So How can I set the consul cluster ip address for sync process?</p>

<p>It looks like the sync service <a href="https://github.com/hashicorp/consul-helm/blob/master/templates/sync-catalog-deployment.yaml#L62-L87" rel="nofollow noreferrer">runs via the consul agent</a> on the k8s host.</p>

<pre><code>          env:
            - name: HOST_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
</code></pre>

<pre><code>          command: 
            - consul-k8s sync-catalog \
                  -http-addr=${HOST_IP}:8500
</code></pre>

<p>That can't be configured directly but helm can configure the agent/client via <a href="https://www.consul.io/docs/platform/k8s/helm.html#v-client-join" rel="nofollow noreferrer"><code>client.join</code></a> (<a href="https://github.com/hashicorp/consul-helm/blob/6fa9be91e5af25143c6ad98fab2d10fa7bdbfde4/values.yaml#L164-L167" rel="nofollow noreferrer">yaml src</a>):</p>

<blockquote>
  <p>If this is null (default), then the clients will attempt to automatically join the server cluster running within Kubernetes. This means that with server.enabled set to true, clients will automatically join that cluster. If server.enabled is not true, then a value must be specified so the clients can join a valid cluster. </p>
</blockquote>

<p>This value is passed to the consul agent as the <a href="https://www.consul.io/docs/agent/options.html#retry-join" rel="nofollow noreferrer"><code>--retry-join</code></a> option.</p>

<pre><code>client:
  enabled: true
  join:
  - consul1
  - consul2
  - consul3
syncCatalog:
  enabled: true
</code></pre>
