superwjc commented on issue #5138:
URL: https://github.com/apache/apisix/issues/5138#issuecomment-927538039
I update the configmap for apisix, add the following options and then
restart the deployment.
```
kubectl -n apisix get configmaps apisix -o yaml > apisix-configmap.yaml
```
```
apisix:
node_listen: 9080 # APISIX listening port
enable_heartbeat: true
enable_admin: true
enable_admin_cors: true
enable_debug: false
enable_dev_mode: false # Sets nginx worker_processes to 1 if
set to true
enable_reuseport: true # Enable nginx SO_REUSEPORT switch if
set to true.
enable_ipv6: true
config_center: etcd # etcd: use etcd to store the config
value
# yaml: fetch the config value from
local yaml file `/your_path/conf/apisix.yaml`
stream_proxy:
only: false
tcp:
- addr: 9100
tls: true
udp:
- addr: 9200
```
```
kubectl -n apisix apply -f apisix-configmap.yaml
```
The newly created pod stuck in 'CrashLoopBackOff' status, and the log showed:
```
failed to validate config: property "apisix" validation failed: property
"stream_proxy" validation failed: property "udp" validation failed: failed to
validate item 1: object matches none of the requireds
```
after removing the udp option, it worked, means that setting the
stream_proxy.udp option in that way is invalid.
```
apisix:
node_listen: 9080 # APISIX listening port
enable_heartbeat: true
enable_admin: true
enable_admin_cors: true
enable_debug: false
enable_dev_mode: false # Sets nginx worker_processes to 1 if
set to true
enable_reuseport: true # Enable nginx SO_REUSEPORT switch if
set to true.
enable_ipv6: true
config_center: etcd # etcd: use etcd to store the config
value
# yaml: fetch the config value from
local yaml file `/your_path/conf/apisix.yaml`
stream_proxy:
only: false
tcp:
- addr: 9100
tls: true
```
```
curl -sS http://10.104.12.30:9180/apisix/admin/stream_routes/1 -H
'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
"remote_addr": "127.0.0.1",
"upstream": {
"nodes": {
"127.0.0.1:1995": 1
},
"type": "roundrobin"
}
}'
```
```
HTTP/1.1 201 Created
Server: openresty
Date: Mon, 27 Sep 2021 05:12:34 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: *
Access-Control-Max-Age: 3600
{"action":"set","node":{"key":"\/apisix\/stream_routes\/1","value":{"remote_addr":"127.0.0.1","update_time":1632719554,"create_time":1632719554,"upstream":{"scheme":"http","pass_host":"pass","type":"roundrobin","hash_on":"vars","nodes":{"127.0.0.1:1995":1}},"id":"1"}}}
```
```
curl -sS http://10.104.12.30:9180/apisix/admin/stream_routes -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' | jq
```
```
{
"node": {
"key": "/apisix/stream_routes",
"dir": true,
"nodes": [
{
"modifiedIndex": 39,
"createdIndex": 39,
"key": "/apisix/stream_routes/1",
"value": {
"remote_addr": "127.0.0.1",
"update_time": 1632719554,
"create_time": 1632719554,
"upstream": {
"scheme": "http",
"pass_host": "pass",
"hash_on": "vars",
"nodes": {
"127.0.0.1:1995": 1
},
"type": "roundrobin"
},
"id": "1"
}
}
]
},
"action": "get",
"count": 1
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]