Envoy Gateway 独立部署模式详解

Envoy Gateway 独立部署模式详解

【免费下载链接】gateway Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway 【免费下载链接】gateway 项目地址: https://gitcode.com/gh_mirrors/gate/gateway

概述

Envoy Gateway 作为云原生 API 网关解决方案,除了支持 Kubernetes 部署外,还提供了独立部署模式(Standalone Deployment Mode)。这种模式允许用户在不依赖 Kubernetes 的情况下,直接在物理机或虚拟机上运行 Envoy Gateway。

独立部署模式特性

独立部署模式目前具有以下核心特性:

  1. 文件提供程序(File Provider):通过文件系统获取所有网关 API 资源配置
  2. 主机基础设施提供程序(Host Infrastructure Provider):将 Envoy Proxy 作为主机进程部署

部署前准备

环境要求

  1. 创建测试目录:
mkdir -p /tmp/envoy-gateway-test
  1. 获取 Envoy Gateway 二进制文件:
  • 可从官方发布渠道获取预编译版本
  • 或通过源码编译:
make build

安全凭证配置

由于 Envoy Gateway 各组件间使用 TLS 加密通信,需先配置必要的安全凭证:

envoy-gateway security-setup --local

本地主机部署指南

配置文件说明

创建 standalone.yaml 配置文件:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyGateway
gateway:
  controllerName: gateway.envoyproxy.io/gatewayclass-controller
provider:
  type: Custom
  custom:
    resource:
      type: File
      file:
        paths: ["/tmp/envoy-gateway-test"]
    infrastructure:
      type: Host
      host: {}
logging:
  level:
    default: info
extensionApis:
  enableBackend: true

关键配置项解析:

  • paths:指定监控的配置文件目录
  • enableBackend:启用后端 API,用于表示本地端点

启动 Envoy Gateway

envoy-gateway server --config-path standalone.yaml

配置更新与测试

  1. 添加配置文件触发更新:
cp examples/standalone/quickstart.yaml /tmp/envoy-gateway-test/quickstart.yaml
  1. 启动测试服务:
python3 -m http.server 3000
  1. 测试访问:
curl --verbose --header "Host: www.example.com" http://0.0.0.0:8888/

容器化部署指南

环境准备

  1. 创建配置目录:
mkdir -p /tmp/envoy-gateway-test/config
chmod -R 777 /tmp/envoy-gateway-test
  1. 创建容器网络:
docker network create envoy-gateway-test

容器化部署步骤

  1. 配置安全凭证:
docker run --rm --volume /tmp/envoy-gateway-test:/tmp/envoy-gateway envoyproxy/gateway:latest security-setup --local
  1. 启动 Envoy Gateway 容器:
docker run \
  --name envoy-gateway \
  --network envoy-gateway-test \
  --publish 8888:8888 \
  --volume /tmp/envoy-gateway-test:/tmp/envoy-gateway \
  --detach \
  envoyproxy/gateway:latest \
  server --config-path /tmp/envoy-gateway/standalone.yaml
  1. 启动测试服务容器:
docker run \
  --name local-server \
  --hostname local-server.local \
  --network envoy-gateway-test \
  --detach \
  python:3 \
  python3 -m http.server 3000

注意事项

  1. 生产环境警告:独立部署模式目前仍处于实验阶段,不建议在生产环境中使用
  2. 权限问题:容器化部署时需确保配置目录有足够权限
  3. 网络配置:容器间通信需确保网络配置正确

常见问题排查

  1. 凭证问题:确保正确配置并配置 TLS 安全凭证
  2. 文件监控:确认配置文件放置在正确目录并被监控
  3. 端口冲突:检查 8888 端口是否被占用

通过以上步骤,您可以快速体验 Envoy Gateway 的独立部署模式,为后续深入使用和评估打下基础。

【免费下载链接】gateway Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway 【免费下载链接】gateway 项目地址: https://gitcode.com/gh_mirrors/gate/gateway

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值