apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
1.02k stars 345 forks source link

add examples about migrating from nginx ingress controller #420

Open lxm opened 3 years ago

lxm commented 3 years ago

Issue description

Due to most people started to get in touch with Kubernetes ingress is using nginx ingress controller, so it is likely to use a lot of nginx ingress's annotations. It's a good idea to add some example about migrating from nginx ingress controller. Such as

    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite ^/api/(.*) /$1 break;
nginx.ingress.kubernetes.io/proxy-body-size

and so on.

tokers commented 3 years ago

@lxm That's right, we may maintain a document to tell people if you're using xxx feature in ingress-nginx, and you're trying to migrate to ingress-apisix, that what you need to configure to achieve the same purpose.

Workload is huge, but we can list some common and important features, adding examples for them preferentially.

tokers commented 3 years ago

@gxthrj @tao12345666333

tao12345666333 commented 3 years ago

We are now expanding the functionality of apisix-ingress, see #397 Use the same annotation similar to ingress-nginx.

gxthrj commented 3 years ago

Sure,We should also add documents to describe

  1. the configuration scope of our support for native k8s Ingress resource.
  2. How to migrate from K8s Ingress resource to ApisixRoute resource.
ps-19 commented 1 year ago

@lxm any feedback?

Identify the annotations used in the nginx ingress controller that you want to migrate.

Before you can migrate from nginx ingress controller to Apisix-ingress, you'll need to identify the annotations used in your nginx ingress controller configuration that you want to migrate. You can do this by examining your Kubernetes manifests and looking for annotations that have the prefix "nginx.ingress.kubernetes.io/". Take note of the names and values of these annotations.

Check if the annotations are supported in Apisix-ingress.

Once you have identified the annotations you want to migrate, check if they are supported in Apisix-ingress. Apisix-ingress has its own set of annotations, which can be found in the official documentation. If an annotation you want to migrate is not listed, you may need to find an alternative solution or implement custom functionality in Apisix-ingress.

Replace the nginx ingress controller annotations with the corresponding annotations supported by Apisix-ingress.

Once you have identified the Apisix-ingress annotations that correspond to the nginx ingress controller annotations you want to migrate, you'll need to update your Kubernetes manifests to use the Apisix-ingress annotations instead. Be sure to update the values of the annotations as well, if necessary.

For example, if you have an nginx ingress controller annotation like this:

nginx.ingress.kubernetes.io/rewrite-target: /$1

You can replace it with the following Apisix-ingress annotation:

apisix.apache.org/rewrite-target: /$1

Update your Kubernetes manifests to use the Apisix-ingress resource.

Next, you'll need to update your Kubernetes manifests to use the Apisix-ingress resource instead of the nginx ingress controller resource. The Apisix-ingress resource is similar to the Kubernetes Ingress resource, but with additional features and functionality.

Here's an example Apisix-ingress resource:

apiVersion: apisix.apache.org/v2alpha1
kind: ApisixIngress
metadata:
  name:
spec:
  rules:
    - host: 
      http:
        paths:
          - path: 
            pathType: 
            backend:
              service:
                name: 
                port:
                  name: http

If you have existing Kubernetes Ingress resources, you can migrate them to ApisixRoute resources.

If you have existing Kubernetes Ingress resources that you want to migrate to Apisix-ingress, you can do so by creating a new ApisixRoute resource with the same configuration as the Ingress resource, and then deleting the Ingress resource.

Here's an example ApisixRoute resource that's equivalent to the example Apisix-ingress resource shown above:

apiVersion: 
kind: ApisixRoute
metadata:
  name: 
spec:
  rules:
    - host: 
      http:
        paths:
          - path: 
            pathType: 
            backend:
              service:
                name: 
                port:
                  name: http

Update your documentation to reflect the changes you've made.

Finally, you'll need to update your documentation to reflect the changes you've made. This should include instructions for using the new Apisix-ingress annotations and resources, as well as any other relevant information about the migration process.

By following these steps, you should be able to migrate from nginx ingress controller to Apisix-ingress with minimal disruption