mikyll commented on issue #12150:
URL: https://github.com/apache/apisix/issues/12150#issuecomment-2809047728

   With the configuration you provided, you're not mounting the custom plugin 
in APISIX container.
   
   You have to:
   
   1. Create a ConfigMap containing the plugin code:
   
       ```yaml
       apiVersion: v1
       kind: ConfigMap
       metadata:
         name: apisix-custom-plugin-log
         namespace: apisix
       data:
         log.lua: |
           local core = require("apisix.core")
           
           local plugin_name = "log"
           
           local _M = {
               version = 0.1,
               priority = 0,
               name = plugin_name,
           }
           
           _M.schema = {
               type = "object",
               properties = {},
           }
           
           function _M.access(conf, ctx)
               core.log.info("log plugin triggered!")
           end
           
           return _M
       ```
       
       (You can create this by running `kubectl create configmap 
apisix-custom-plugin-log --from-file=./log.lua -n apisix --dry-run=client -o 
yaml`)
   
   2. Mount the ConfigMap to the container. In your apisix Deployment, add the 
following volume and volumeMount:
   
       ```yaml
       ---
       apiVersion: apps/v1
       kind: Deployment
       metadata:
         name: apisix
         namespace: apisix
       # [...]
       spec:
         template:
           spec:
             containers:
             - name: apisix
               # [...]
               volumeMounts:
               - name: custom-plugin-log
                 mountPath: /usr/local/apisix/apisix/plugins/log.lua
                 subPath: log.lua
             volumes:
             - name: custom-plugin-log
               configMap:
                 name: apisix-custom-plugin-log
       ```
   
   This should load your plugin correctly 🙂 
   
   For further information, you can have a look at the official documentation: 
[APISIX Docs | Using custom Plugins in APISIX 
Ingress](https://apisix.apache.org/docs/ingress-controller/tutorials/using-custom-plugins/)


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to