K8s 环境下使用 HostNetwork 模式部署 Envoy Gateway

185 字
1 分钟
K8s 环境下使用 HostNetwork 模式部署 Envoy Gateway

记录一下,后续完善

Terminal window
root@k8s-master:~/gateway/deploy# ls
app-httproute-nginx.yaml gatewayclass.yaml infra-envoyproxy.yaml infra-gateway.yaml
root@k8s-master:~/gateway/deploy# cat gatewayclass.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: shared-gw-class
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
root@k8s-master:~/gateway/deploy# cat infra-envoyproxy.yaml
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: shared-gw-proxy
namespace: infra-gw
spec:
provider:
type: Kubernetes
kubernetes:
useListenerPortAsContainerPort: true
envoyService:
type: ClusterIP
envoyDaemonSet:
patch:
value:
spec:
template:
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
# 添加这个容忍配置
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
container:
securityContext:
runAsUser: 0
allowPrivilegeEscalation: true
#image: envoyproxy/envoy:distroless-v1.36.2
root@k8s-master:~/gateway/deploy# cat infra-gateway.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: shared-gateway
namespace: infra-gw
spec:
gatewayClassName: shared-gw-class
infrastructure:
parametersRef:
group: gateway.envoyproxy.io
kind: EnvoyProxy
name: shared-gw-proxy
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All # 允许所有 namespace 的 Route 绑定到这个 Gateway
root@k8s-master:~/gateway/deploy# cat app-httproute-nginx.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: nginx
namespace: nginx-deploy-ns
spec:
parentRefs:
- name: shared-gateway
namespace: infra-gw # 指向基础设施 ns 的共享 Gateway
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: nginx-service # app-namespace 里的 nginx Service
port: 80

文章分享

如果这篇文章对你有帮助,欢迎分享给更多人!

K8s 环境下使用 HostNetwork 模式部署 Envoy Gateway
https://blog.nwn.moe/posts/k8s-gateway-envoy-hostnetwork/
作者
籽夏
发布于
2025-12-10
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
籽夏
谎言的代价是什么?
公告
欢迎来到我的博客!
分类
标签
站点统计
文章
15
分类
3
标签
12
总字数
34,084
运行时长
0
最后活动
0 天前
站点信息
文章许可
CC BY-NC-SA 4.0
构建时间
2026年8月29日 00:03:12

当前页面没有目录