basuotian commented on issue #10608:
URL: https://github.com/apache/apisix/issues/10608#issuecomment-1844147345

   try to use ApisixRoute instead of Ingress, ApisixRoute contains plugins field
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: apisix-dashboard
   spec:
     http:
     - backends:
       - serviceName: apisix-dashboard
          servicePort: 80
       match:
         hosts:
         - apisix-dashboard.mytest.com
         paths:
         - /*
       name: apisix-dashboard
       plugins:
       - name: elasticsearch-logger
         enable: true
         config:
           endpoint_addr: "http://192.168.1.5:9200";
           field: 
             index: "services-apisix-dashboard"
   ```
   
   if you insist to use Ingress, you should create an ApisixPluginConfig like
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixPluginConfig
   metadata:
     name: test-plugin
   spec:
     plugins:
     - name: elasticsearch-logger
       enable: true
       config:
         endpoint_addr: "http://192.168.1.5:9200";
         field: 
           index: "services-apisix-dashboard"
   ```
   then add annotation to your Ingress object
   ```yaml
   metadata:
     annotations:
       k8s.apisix.apache.org/plugin-config-name: elasticsearch-logger
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to