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

 

posted @   awks  阅读(197)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示