zoukankan      html  css  js  c++  java
  • 全局插件配置

    echo "
    apiVersion: configuration.konghq.com/v1
    kind: KongPlugin
    metadata:
      name: global-rate-limit
      labels:
        global: "true"
    config:
      minute: 5
      limit_by: consumer
      policy: local
    plugin: rate-limiting
    " | kubectl apply -f -
    kongplugin.configuration.konghq.com/global-rate-limit created

    With this plugin (please note the global label), every request through Kong Ingress Controller will be rate-limited:

    $ curl -I $PROXY_IP/foo -H 'apikey: sooper-secret-key'
    HTTP/1.1 200 OK
    Content-Type: text/html; charset=utf-8
    Content-Length: 9593
    Connection: keep-alive
    Server: gunicorn/19.9.0
    Date: Wed, 17 Jul 2019 22:34:10 GMT
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Credentials: true
    X-RateLimit-Limit-minute: 5
    X-RateLimit-Remaining-minute: 4
    demo:  injected-by-kong
    X-Kong-Upstream-Latency: 3
    X-Kong-Proxy-Latency: 1
    Via: kong/1.2.1
    
    $ curl -I $PROXY_IP/bar  ----匿名访问
    HTTP/1.1 200 OK
    Content-Type: text/plain; charset=UTF-8
    Connection: keep-alive
    Date: Wed, 17 Jul 2019 22:34:14 GMT
    Server: echoserver
    X-RateLimit-Limit-minute: 5
    X-RateLimit-Remaining-minute: 4
    demo:  injected-by-kong
    X-Kong-Upstream-Latency: 2
    X-Kong-Proxy-Latency: 1
    Via: kong/1.2.1
     
  • 相关阅读:
    MongoDB理解
    jQuery+Ajax+PHP实现异步分页数据显示
    PHP设计模式四:适配器模式
    PHP设计模式三:原型设计模式
    Event Managers
    NetAdvantage
    英语
    CA1060
    DateTime和DateTime2
    宿主进程 vshost.exe
  • 原文地址:https://www.cnblogs.com/justart/p/12436431.html
Copyright © 2011-2022 走看看