API 网关 (Ingress)#
简介#

Ingress 是所有 Jetson 平台服务 API 的 API 网关。它充当反向代理,所有传入的 API 请求都通过它,然后它根据路径前缀将请求转发到适当的微服务。
该端点是未受保护且未加密的,因为它主要在内部(企业网络内)使用。 对特定服务的每个请求都应以服务名称为前缀 (/vst/ /emdx/ /grafana/ …)。 默认端口为 30080。
以下是通过 Ingress 向 VST 发出的示例请求。 curl localhost:30080/vst/api/device/list
配置#
要通过 Ingress 将服务暴露给外部,请按如下方式创建 Ingress 配置文件。
my-svc-nginx.conf
location /genai/ {
rewrite ^/genai/?(.*)$ /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log /var/log/nginx/access.log timed_combined;
proxy_pass https://127.0.0.1:5010;
}
在示例文件中,我们通过 Ingress 暴露一个带有 genai 前缀的应用。 我们的应用在内部端口 5010 上运行。 确保没有其他服务监听您选择的同一端口。 此配置文件 (my-svc-nginx.conf) 应复制到 /opt/nvidia/jetson/services/ingress/config/。 下一步是按如下方式重启 Ingress
sudo systemctl restart jetson-ingress
启动和停止服务#
sudo systemctl start jetson-ingress
sudo systemctl stop jetson-ingress
sudo systemctl restart jetson-ingress