Migrating applications from NGINX Ingress to Gwin
Yandex Application Load Balancer allows you to create and manage load balancers in Yandex Managed Service for Kubernetes clusters using the Gwin controller. Installed in a cluster, the Gwin controller automatically deploys L7 load balancers based on the configuration of your Kubernetes resources.
To migrate applications from the NGINX Ingress Controller to Gwin, follow these steps:
- Install the Gwin controller in your cluster.
- Migrate custom annotations from the NGINX Ingress controller to the Gwin controller using the mapping table.
- Switch the workload over to the Gwin controller.
Mapping table of Ingress NGINX and Gwin annotations
The table gives abbreviated annotation names for NGINX and Gwin. Full annotation names start with nginx.ingress.kubernetes.io/ for NGINX, and gwin.yandex.cloud/ for Gwin.
|
NGINX |
Gwin |
Description |
|
Redirection |
||
|
|
Redirects to another protocol (HTTP/HTTPS) |
|
|
|
redirect.{name}.replaceScheme |
Redirect to another address Gwin specifies |
|
|
rules.prefixRewrite |
Rewrites URLs at the proxy level without changing the address in the browser |
|
Backend configuration |
||
|
|
rules.backends.tls.sni |
Establishes the connection protocol between the load balancer and backends |
|
Client authentication |
||
|
|
{resource}.rbac.principals.{principal-group}.{principal}.{rule-type} |
In NGINX, authentication is performed via HTTP (Basic/Digest) or TLS certificates, whereas in Gwin, using the role-based access control (RBAC) system. RBAC manages access to routes and hosts based on request attributes. |
|
Binding a session to a backend |
||
|
|
rules.sessionAffinity.header.name |
NGINX allows session binding via cookies; Gwin does the same via cookies, headers, or IP addresses |
|
Backend certificate verification |
||
|
|
rules.backends.tls.sni |
NGINX sets up certificate verification through SSL; Gwin uses TLS |
|
Connection timeouts |
||
|
|
In Gwin, you set a general backend response timeout and an idle timeout |
|
|
Rate limit |
||
|
|
hosts.rateLimit.allRequests.perSecond |
Sets the maximum number of requests you can send within a time interval |
|
Logging |
||
|
|
logs.logGroupID |
Enables logging In Gwin, you can also configure logging parameters |
|
Other |
||
|
|
directResponse.{name}.responseCode |
Specifies the error code and response text |
|
|
Determines the HTTP version for backend interaction |
|
|
|
Sets the number of requests from one IP per second |
|
|
|
rules.modifyResponseHeaders.append.{header-name} |
Set response headers |
|
|
Sets the load balancing algorithm |
Switch workload to the Gwin controller
Creating new resources in the cluster
-
Apply the updated YAML manifests using the following command:
kubectl apply -f <YAML_file_or_folder>.This will create a new load balancer without removing the existing one.
-
Make sure all resources were successfully created by checking their status with the
kubectl getcommand.
Checking that your load balancing is correct
Test the new load balancer to ensure it functions correctly:
- Get the IP address of your new load balancer:
- Retrieve the
Ingressresource status using thekubectl get Ingresscommand. - In the management console
, do the following:- Go to the Managed Service for Kubernetes cluster page.
- In the left-hand panel, select
Network. - Navigate to the Ingress tab.
- Retrieve the
- Make sure routing behaves as expected by testing the availability of your app's HTTP/HTTPS endpoints.
- Make sure backend health checks report all backends as healthy.
- Check the logs for errors and review the load balancer metrics for any signs of performance issues.
Redirecting traffic to the new load balancer
- Update your domain DNS records to point to the new load balancer's IP address, thereby redirecting traffic.
- Monitor app metrics during the traffic switchover.
- Make sure the app's features remain fully accessible after the traffic redirection.
Deleting the resources you no longer need
- Delete your old NGINX Ingress resources, i.e., original ingress controllers, backend groups, etc.
- Remove any unused load balancers or TLS certificates.