ai-gateway 安装记录
背景
ai-gateway是envoy的另一个项目。
https://aigateway.envoyproxy.io/
现在都ai/agent了,非常方便。甚至不用自己动手,所以后续的文章也不会再写那么细的细节,
只写个脉络,为的是理解机制。
Get Started
https://aigateway.envoyproxy.io/docs/getting-started/
1 k8s安装
k8s集群从0到1安装部署
https://www.cnblogs.com/hugetong/p/18722210
2 helm/curl安装
https://helm.sh/docs/intro/install/
3 安装ai-gateway
ai-gateway依赖 envoy gateway 需要先装 envoy gateway
安装有两个方法,一个是用kubectl apply安装。一个是用helm。
helm的用途主要是渲染 kubectl 安装时的yaml,这里我们用helm
安装 envoy gateway
helm upgrade -i eg oci://docker.io/envoyproxy/gateway-helm \ --version v1.8.1 \ --namespace envoy-gateway-system \ --create-namespace \ -f https://raw.githubusercontent.com/envoyproxy/ai-gateway/main/manifests/envoy-gateway-values.yaml \ -f https://raw.githubusercontent.com/envoyproxy/ai-gateway/main/examples/token_ratelimit/envoy-gateway-values-addon.yaml \ -f https://raw.githubusercontent.com/envoyproxy/ai-gateway/main/examples/inference-pool/envoy-gateway-values-addon.yaml
安装 ai gateway
helm upgrade -i aieg-crd oci://docker.io/envoyproxy/ai-gateway-crds-helm \ --version v1.0.0 \ --namespace envoy-ai-gateway-system \ --create-namespace
helm upgrade -i aieg oci://docker.io/envoyproxy/ai-gateway-helm \ --version v1.0.0 \ --namespace envoy-ai-gateway-system \ --create-namespace
安装数据面
vim gatewayclass.yaml --------------- apiVersion: gateway.networking.k8s.io/v1 kind: GatewayClass metadata: name: eg spec: controllerName: gateway.envoyproxy.io/gatewayclass-controller parametersRef: group: gateway.envoyproxy.io kind: EnvoyProxy name: ai-gateway-proxy namespace: envoy-gateway-system --------------- kubectl apply -f gatewayclass.yaml vim gateway.yaml --------------- apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: ai-gateway namespace: default spec: gatewayClassName: eg listeners: - name: http protocol: HTTP port: 80 ---------------- kubectl apply -f gateway.yaml
解决网络问题
如果k8s master不能之间访问 docker.io,一般就需要找一个 似有镜像仓库做中转, 大概流程包括如下的主要步骤
1 将远程yaml批量导入到本地
helm pull
helm template
2 找到需要的image
通过 grep 等方法,在template yaml 里找到相关image, 如 grep docker.io 等字符串。
3 转移到镜像仓库
docker pull // docker.io
docker tag // 打私有镜像仓库的标
docker login // 登陆私有镜像仓库
docker push // 推送到私有镜像仓库
4 使用私有仓库进行安装
vim 编写一个 values.yaml 覆盖镜像配置到似有仓库。
helm update -i gateway -f values.yaml
官网的mock后端例子
https://raw.githubusercontent.com/envoyproxy/ai-gateway/main/examples/basic/basic.yaml
理解安装
前边的文档是快速安装步骤,如果你想学习,需要好好读下面的内容:
helm的安装文档是一键式的,隐藏了很多细节。
读这个:https://gateway.envoyproxy.io/latest/install/install-helm/ 能学到更多。
https://gateway.envoyproxy.io/docs/install/install-yaml/
EPP安装
到这里只完成了一半安装,后面还有EPP等,
参考:https://aigateway.envoyproxy.io/docs/capabilities/inference/aigatewayroute-inferencepool
浙公网安备 33010602011771号