apisix-ingress-controller icon indicating copy to clipboard operation
apisix-ingress-controller copied to clipboard

request help: How to start multiple unrelated ingress-apisix-composite-deployment to load traffic from different sources

Open bren-ai opened this issue 1 year ago • 10 comments

Issue description

I created ingress-apisix-composite-deployment in two namespaces (ingress-apisix, ingress-apisix-2) respectively. The purpose is to use different ingress-apisix-composite-deployment for different source traffic. I modified etcd -server-prefix, and modified the annotations in ingress-apisix-composite-deployment, but the purpose cannot be achieved

The following error will be prompted: 2024-01-24T13:28:21+08:00 error apisix/apisix_route.go:892 failed to record status change for ApisixRoute {"error": "Operation cannot be fulfilled on apisixroutes.apisix.apache.org "test-web-2": the object has been modified; please apply your changes to the latest version and try again", "name": "test-web-2", "namespace": "demo"}

screenshot-20240124-134508 screenshot-20240124-134724-2

Environment

  • your apisix-ingress-controller version (output of apisix-ingress-controller version --long): image version : apache/apisix-ingress-controller:1.8.0,apache/apisix:3.6.0-centos kubectl -n ingress-apisix logs -f pods/ingress-apisix-composite-deployment-7c6957dcd8-2jnmm 2024-01-24T13:25:50+08:00 info ingress/ingress.go:121 init apisix ingress controller 2024-01-24T13:25:50+08:00 info ingress/ingress.go:123 version: Version: 1.8.0 Git SHA: no-git-module Go Version: go1.20.13 Building OS/Arch: linux/amd64 Running OS/Arch: linux/amd64

  • your Kubernetes cluster version (output of kubectl version): v1.24.0

  • if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (uname -a): Ubuntu 20.04.6 LTS, Linux k8s-All-in-One 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

bren-ai avatar Jan 24 '24 05:01 bren-ai

@bren-ai Make sure that you set the watching namespace parameter for each deployment of ingress controller different so that they don't interfere with each other. Here it looks like both controllers are trying to modify the same resource.

Revolyssup avatar Jan 25 '24 06:01 Revolyssup

@bren-ai Make sure that you set the watching namespace parameter for each deployment of ingress controller different so that they don't interfere with each other. Here it looks like both controllers are trying to modify the same resource.

can we provide a docs for multiple install?

Vacant2333 avatar Jan 25 '24 15:01 Vacant2333

I modified the configuration after installation. The exported deployment, config, and clusterrolebinding are the configurations currently in use after I modified them.

This is my configuration: demo.tgz Reference documentation: https://apisix.apache.org/zh/blog/2023/10/18/ingress-apisix/#%E5%AE%89%E8%A3%85-apisix-ingress-controller @Vacant2333 @Revolyssup Thank you very much for the answer

bren-ai avatar Jan 26 '24 06:01 bren-ai

I modified the configuration after installation. The exported deployment, config, and clusterrolebinding are the configurations currently in use after I modified them.

This is my configuration: demo.tgz Reference documentation: https://apisix.apache.org/zh/blog/2023/10/18/ingress-apisix/#%E5%AE%89%E8%A3%85-apisix-ingress-controller @Vacant2333 @Revolyssup Thank you very much for the answer

good! i think we can close the issue now?

Vacant2333 avatar Jan 26 '24 13:01 Vacant2333

I want to know how to achieve my goal, How to start multiple unrelated ingress-apisix-composite-deployment to load traffic from different sources

bren-ai avatar Jan 28 '24 07:01 bren-ai

This is our values override for running a second controller via the Helm chart. We do this to have an internal-only load balancer, but maybe expanded on what you want to achieve could help us understand what you're actually trying to do here.

ingress-controller:
  config:
    ingressPublishService: apisix/apisix-internal-gateway
    kubernetes:
      ingressClass: apisix-internal
      electionId: ingress-apisix-internal-leader
    apisix:
      serviceName: apisix-internal-admin
      serviceNamespace: apisix
gateway:
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"

Note that you also have to use the ingress name in all your CRDs to not have them processed by both controllers.

acuteaura avatar Jan 31 '24 07:01 acuteaura

Thanks for the answer. The purpose is only to safely isolate the traffic entrance, which is divided into public and private traffic entrances. @acuteaura

bren-ai avatar Feb 01 '24 02:02 bren-ai

Is there a way to have multiple independant instances sharing the same objects ? For example I have 2 instances of the apisix helm chart (each with their own etcd and apisix-ingress-controler), 1 for private routes (via internal ALB) and another for public routes (via public LB).

I have some services that need to expose both public and private routes, how can I achieve this ?

I get the same issue so far, facing the the object has been modified; please apply your changes to the latest version and try again error.

For example should I add something to this for it to work ? (it only needs to be in the public one in this example)

apiVersion: apisix.apache.org/v2
kind: ApisixPluginConfig
metadata:
  name: ecgator-plugins
spec:
  plugins:
    - name: proxy-rewrite
      enable: true
      config:
        uri: /upload

kedare avatar Feb 12 '24 17:02 kedare

Write two objects (with whatever templating/generator you use) and set spec.ingressClassName

acuteaura avatar Feb 12 '24 19:02 acuteaura

This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar May 13 '24 01:05 github-actions[bot]

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.

github-actions[bot] avatar Jun 12 '24 01:06 github-actions[bot]