Hi There,
I am working with k8s and am using kong 0.14 as my ingress controller. I am trying to add some plugins to various services but they never show up. I exec into the ingress controller and do curl localhost:8081/services
and see there are no plugins.
Below is my kubectl deployment definition, I am adding the cors plugin to the services with an annotation:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mygunicorn-gunicorn
spec:
replicas: 3
selector:
matchLabels:
app: mygunicorn-gunicorn
template:
metadata:
labels:
app: mygunicorn-gunicorn
spec:
containers:
- name: mygunicorn-gunicorn
image: docker.weightrack.io/mygunicorn-gunicorn
env:
- name: GUNICORN_WORKERS
value: "5"
---
apiVersion: v1
kind: Service
metadata:
name: mygunicorn-gunicorn
labels:
app: mygunicorn-gunicorn
annotations:
plugins.konghq.com: mygunicorn-kong-cors
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
name: mygunicorn-gunicorn-http
selector:
app: mygunicorn-gunicorn
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: api.weightrack.io-mygunicorn-gunicorn
spec:
rules:
- host: api.weightrack.io
http:
paths:
- path: /mygunicorn
backend:
serviceName: mygunicorn-gunicorn
servicePort: 80
---
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: mygunicorn-kong-cors
namespace: kong
plugin: cors
config:
origins:
- api.weightrack.io
- app.weightrack.io
methods:
- GET
- HEAD
- PUT
- PATCH
- POST
preflight_continue: "true"
After looking at the documents, I am not sure what config piece I am missing. I have tried making the plugin be namespaced for “kong” and “default” (where my app resides), I have also tried adding the annotation to the service and the controller to no success.
Can anyone advise? The docs on KongPlugins and how to add them to services is pretty weak at the moment so I am struggling for guidance.
I have also tried using config.<config item>
in the config block with no luck.