hashicorp / hashicorp/consul

Lua Envoy extension outbound listener is not working

Open
#21,966 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Overview of the Issue
I'm following documentation of [lua envoy extension](https://developer.hashicorp.com/consul/docs/connect/proxies/envoy-extensions/usage/lua) and try to setup both inbound and outbound listener. Inbound extension works good but outbound one is not working. When I check the log of my consul-dataplane in my service deployment pod, I found this:
> 2024-11-22T04:12:56.174Z+00:00 [info] envoy.lua(14) envoy_on_response() function not found. Lua filter will not hook responses.

Could anyone provide a working example of how to setup a outbound listener?

P.S. When I apply the change use kubectl apply, seems like this change is not take effect. So everytime I have first kubectl delete and then kubectl apply to make those change take effection. Am I missing anything or it's the expected behavior?

---

#### Reproduction Steps

My serviceDefault config is like this
```yaml
envoyExtensions:
- name: "builtin/lua" # has to be this so it can be recognized by envoy
arguments:
proxyType: "connect-proxy"
listener: "inbound"
script: |-
function envoy_on_request(request_handle)
request_handle:logInfo("simple log test")
request_handle:headers():add("x-consul-service", "auth-service")
end
- name: "builtin/lua" # has to be this so it can be recognized by envoy
arguments:
proxyType: "connect-proxy"
listener: "outbound"
script: |-
function envoy_on_response(request_handle)
request_handle:logInfo("---outbound!!!---")
end
- name: builtin/ext-authz
arguments:
listenerType: inbound
proxyType: connect-proxy
config:
httpService:
target:
service:
name: eks-micro-auth-service
namespace: default
timeout: "5s" # Required timeout field
```

both inbound listener and ext-authz works for me, but when I check the log of my consul-dataplane in my service deployment pod, I found this:
> 2024-11-22T04:12:56.174Z+00:00 [info] envoy.lua(14) envoy_on_response() function not found. Lua filter will not hook responses.

### Consul info for both Client and Server

Client info

```
Output from client 'consul info' command here
```

```
Client agent HCL config
```

Server info

```
Output from server 'consul info' command here
```

```
Server agent HCL config
```

### Operating system and Environment details

### Log Fragments

Contributor guide

Open the contributing guide

Research direction

Start with the linked Lua Envoy extension usage documentation and the provided serviceDefault envoyExtensions YAML; reproduce the outbound connect-proxy listener and inspect the consul-dataplane Envoy log. Compare the inbound and outbound configurations, then verify whether kubectl apply updates the listener without deleting the deployment. Done means a confirmed working outbound example and a clear explanation of the update behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, lua
Domain
devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.