<p>In a consul-connect-service-mesh (using k8) how do you get to the consul-api itself?
For example to access the consul-kv.</p>
<p>I'm working through this <a href="https://www.consul.io/docs/k8s/connect" rel="nofollow noreferrer">tutorial</a>, and I'm wondering how
you can bind the consul (http) api in a service to localhost.</p>
<p>Do you have to configure the Helm Chart further?
I would have expected the consul-agent to always be an upstream service.</p>
<p>The only way i found to access the api is via the k8-service consul-server.</p>
<p>Environment:</p>
<ul>
<li>k8 (1.22.5, docker-desktop)</li>
<li>helm consul (0.42)</li>
<li>consul (1.11.3)</li>
<li>used helm-yaml</li>
</ul>
<pre><code>global:
  name: consul
  datacenter: dc1
server:
  replicas: 1
  securityContext:
    runAsNonRoot: false
    runAsGroup: 0
    runAsUser: 0
    fsGroup: 0
ui:
  enabled: true
  service:
    type: 'NodePort'
connectInject:
  enabled: true
controller:
  enabled: true
</code></pre>

Florian Hilfenhaus
<p>You can access the Consul API on the local agent by using the Kubernetes downward API to inject an environment variable in the pod with the IP address of the host. This is documented on Consul.io under <a href="https://www.consul.io/docs/k8s/installation/install#accessing-the-consul-http-api" rel="nofollow noreferrer">Installing Consul on Kubernetes: Accessing the Consul HTTP API</a>.</p>
<p>You will also need to exclude port 8500 (or 8501) from redirection using the <a href="https://www.consul.io/docs/k8s/annotations-and-labels#consul-hashicorp-com-transparent-proxy-exclude-outbound-ports" rel="nofollow noreferrer"><code>consul.hashicorp.com/transparent-proxy-exclude-outbound-ports</code></a> label.</p>
