curl https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/master/deploy/single/all-in-one-postgres.yaml | kubectl create -f -
kubectl get all --namespace kong
curl https://raw.githubusercontent.com/Codegazers/k8s-vagrant/master/examples/colors/colors.yml | kubectl create -f -
kubectl get all --namespace default
kubectl get all --namespace kong
export KONG_ADMIN_PORT=$(minikube service -n kong kong-ingress-controller --url --format "")
export KONG_ADMIN_IP=$(minikube service -n kong kong-ingress-controller --url --format "")
export PROXY_IP=$(minikube service -n kong kong-proxy --url --format "" | head -1)
export HTTP_PORT=$(minikube service -n kong kong-proxy --url --format "" | head -1)
export HTTPS_PORT=$(minikube service -n kong kong-proxy --url --format "" | tail -1)
curl https://raw.githubusercontent.com/Codegazers/k8s-vagrant/master/examples/colors/colors-ingress.yml | kubectl apply -f -
kubectl get ingress colors-ingress -o yaml
http ${PROXY_IP}:${HTTP_PORT}/text Host:red.example.com
http ${PROXY_IP}:${HTTP_PORT}/text Host:blue.example.com
http ${KONG_ADMIN_IP}:${KONG_ADMIN_PORT}/upstreams/default.red-svc.80/targets
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: add-ratelimiting-to-route
config:
minute: 20
limit_by: ip
second: 5
" | kubectl create -f -
kubectl patch ingress colors-ingress \
-p '{"metadata":{"annotations":{"rate-limiting.plugin.konghq.com":"add-ratelimiting-to-route\n"}}}'
http ${KONG_ADMIN_IP}:${KONG_ADMIN_PORT}/plugins
http ${KONG_ADMIN_IP}:${KONG_ADMIN_PORT}/routes
http ${PROXY_IP}:${HTTP_PORT}/text Host:red.example.com
http ${PROXY_IP}:${HTTP_PORT}/text Host:blue.example.com
kubectl delete ingress colors-ingress
curl https://raw.githubusercontent.com/Codegazers/k8s-vagrant/master/examples/colors/red-ingress.yml | kubectl create -f -
curl https://raw.githubusercontent.com/Codegazers/k8s-vagrant/master/examples/colors/blue-ingress.yml | kubectl create -f -
kubectl patch ingress red-ingress \
-p '{"metadata":{"annotations":{"rate-limiting.plugin.konghq.com":"add-ratelimiting-to-route\n"}}}'
kubectl patch ingress blue-ingress \
-p '{"metadata":{"annotations":{"rate-limiting.plugin.konghq.com":"add-ratelimiting-to-route\n"}}}'
kubectl patch svc red-svc \
-p '{"metadata":{"annotations":{"rate-limiting.plugin.konghq.com": "add-ratelimiting-to-route\n"}}}'
http ${KONG_ADMIN_IP}:${KONG_ADMIN_PORT}/plugins
http ${PROXY_IP}:${HTTP_PORT}/text Host:red.example.com