Kong / kubernetes-ingress-controller

:gorilla: Kong for Kubernetes: The official Ingress Controller for Kubernetes.
https://docs.konghq.com/kubernetes-ingress-controller/
Apache License 2.0
2.22k stars 592 forks source link

kubernetes ingress controller request size limit #606

Closed MarsForever closed 4 years ago

MarsForever commented 4 years ago

NOTE: GitHub issues are reserved for bug reports only. For anything else, please join the conversation in Kong Nation https://discuss.konghq.com/c/kubernetes.


Summary

How to use yaml file to create kong plugins for request limit size(databaseless).

Kong Ingress controller version 0.8

Kubernetes version

17.0.0

Environment

rainest commented 4 years ago

Hello @MarsForever, please note that you should post questions to https://discuss.konghq.com/c/kubernetes in the future; issues are reserved for bug reports.

The various kinds of plugin relations are created via annotations on other resources, as shown in the diagram at https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/concepts/custom-resources.md#kongplugin

Example configuration for the size limiting plugin can be found at https://docs.konghq.com/hub/kong-inc/request-size-limiting/#enabling-the-plugin-on-a-service. KongPlugin use the same format as the config block under the "Without a database" example.

MarsForever commented 4 years ago

Thanks for your answer. @rainest

My question is how to add request-size-limiting to services(route,consumer)

I try to add request-size-limiting to ingress's annotation Method 1

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: request-size-limiting
plugin: request-size-limiting
config:
    allowed_playod_size: 1
    size_unit: bytes

kubectl exec -it ingress-controll-xxx-xxx sh

curl -k https://localhost:8444/plugins

{"next":null, "data":[]}

I tried the following url https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/guides/using-consumer-credential-resource.md

and I get datas, sorry i can't show the datas because of company's credentials

curl -k https://localhost:8444/plugins

Method 2 I add the request size limiting to configmap yaml files and deployed it to ingress-controller-xxx-xxx's container proxy /etc/kong/kong.yml

curl -k https://localhost:8444/plugins

{"next":null, "data":[]}

rainest commented 4 years ago

Can you share the resource you applied the plugin to? That's shown in the second example at https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/guides/using-consumer-credential-resource.md#add-authentication-to-the-service for an Ingress, but the same annotation can be used for Service or KongConsumer resources:

konghq.com/plugins: request-size-limiting
hbagdi commented 4 years ago

Closing this due to lack of activity. Please re-open if needed.