k8s部署kong
官网:https://docs.konghq.com/kubernetes-ingress-controller/2.0.x/references/custom-resources/ github地址:https://github.com/Kong/kubernetes-ingress-controller 保留客户端真实IP地址:https://docs.konghq.com/kubernetes-ingress-controller/2.0.x/guides/preserve-client-ip/
1、下载yaml
wget https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/master/deploy/single/all-in-one-dbless.yaml
2、编辑Service
--- apiVersion: v1 kind: Service metadata: annotations: service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp service.beta.kubernetes.io/aws-load-balancer-type: nlb name: kong-proxy namespace: kong spec: ports: - name: proxy port: 80 protocol: TCP targetPort: 8000 - name: proxy-ssl port: 443 protocol: TCP targetPort: 8443 - name: konga-api port: 8001 protocol: TCP targetPort: 8001 selector: app: ingress-kong type: NodePort
3、编辑kong变量
- env: - name: KONG_PROXY_LISTEN value: 0.0.0.0:8000 reuseport backlog=16384, 0.0.0.0:8443 http2 ssl reuseport backlog=16384 - name: KONG_PORT_MAPS value: 80:8000, 443:8443 - name: KONG_ADMIN_LISTEN #value: 127.0.0.1:8444 http2 ssl reuseport backlog=16384 value: 0.0.0.0:8001,127.0.0.1:8444 http2 ssl reuseport backlog=16384 - name: KONG_STATUS_LISTEN value: 0.0.0.0:8100 - name: KONG_DATABASE value: "off" - name: KONG_NGINX_WORKER_PROCESSES value: "2" - name: KONG_KIC value: "on" # 获取真实IP - name: KONG_TRUSTED_IPS value: "0.0.0.0/0,::/0" - name: KONG_REAL_IP_HEADER value: "X-Forwarded-For" - name: KONG_ADMIN_ACCESS_LOG value: /dev/stdout - name: KONG_ADMIN_ERROR_LOG value: /dev/stderr - name: KONG_PROXY_ERROR_LOG value: /dev/stderr - name: KONG_ROUTER_FLAVOR value: traditional
3、部署
kubectl apply -f all-in-one-dbless.yaml
部署konga参考:https://www.cnblogs.com/linjiangCN/p/16982999.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了