apache/apisix working mocking plugin example

I’ve installed apisix and apisix-dashboard with helm on my k8s cluster.
I used all defaults except APIKEY for admin and viewer acc., and custom username/password for dashboard. So I’m currently running the 3.15 version.

My installation steps

helm repo add apisix https://charts.apiseven.com 
helm repo update 
# installing apisix/apisix
helm install --set-string admin.credentials.admin="new_api_key"
    --set-string admin.credentials.viewer="new_api_key" apisix apisix/apisix --create-namespace  --namespace my-apisix
# installing apisix/apisix-dashboard, where values.yaml contains username/password
helm install -f values.yaml apisix-dashboard apisix/apisix-dashboard --create-namespace --namespace my-apisix

I’m unable to configure the mocking plugin, I’ve been following the docs.
In the provided example I’m unable to call the API on route with ID 1, so I’ve created a custom route and after that used the VIEW json, where I’ve changed the configuration accordingly to the sample provided.
All calls on this routes are returning 502 errors, in the logs i can see the route is routing traffic to a non existing server. All of that leads me to believe that the mocking plugin is disabled.

Example of my route:

  "uri": "/mock-test.html",
  "name": "mock-sample-read",
  "methods": [
  "plugins": {
    "mocking": {
      "content_type": "application/json",
      "delay": 1,
      "disable": false,
      "response_schema": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "properties": {
          "a": {
            "type": "integer"
          "b": {
            "type": "integer"
        "required": [
        "type": "object"
      "response_status": 200,
      "with_mock_header": true
  "upstream": {
    "nodes": [
        "host": "",
        "port": 1980,
        "weight": 1
    "timeout": {
      "connect": 6,
      "send": 6,
      "read": 6
    "type": "roundrobin",
    "scheme": "https",
    "pass_host": "node",
    "keepalive_pool": {
      "idle_timeout": 60,
      "requests": 1000,
      "size": 320
  "status": 1

Can anyone provide me with an actual working example or point out what I’m missing? Any suggestions are welcomed.

Leave a Reply

Your email address will not be published. Required fields are marked *