This topic describes how to upgrade ack-ingress-nginx that is installed on the Marketplace page in the Container Service for Kubernetes (ACK) console.
Background information
The Ingress API v1beta1 is deprecated in Kubernetes 1.24. If NGINX Ingress controller 0.44.0 is installed by ack-ingress-nginx, the controller uses the Ingress API v1beta1. In this case, the NGINX Ingress controller cannot run as expected after you upgrade the Kubernetes version of your cluster to 1.24.
NGINX Ingress controller 1.1.0 and later are deployed by ack-ingress-nginx-v1. To ensure that the NGINX Ingress controller can run as expected, we recommend that you replace ack-ingress-nginx with ack-ingress-nginx-v1.
This topic is not applicable to the NGINX Ingress controller that is deployed from the Add-ons page in the ACK console. For more information about how to manage the NGINX Ingress controller that is deployed from the Add-ons page, see Update the NGINX Ingress controller.
Prerequisites
An ACK cluster that runs Kubernetes 1.20 or later is created.
You can select the chart version 4.0.17 or later (ack-ingress-nginx-v1 1.8.0-aliyun.1 or later) only if your ACK cluster runs Kubernetes 1.22 or later. If your ACK cluster runs Kubernetes 1.20, select the chart version 4.0.16 (ack-ingress-nginx-v1 1.2.1-aliyun.1).
ack-ingress-nginx is installed in the cluster from the Marketplace page in the ACK console.
Step 1: Install ack-ingress-nginx-v1
Install ack-ingress-nginx-v1 from the Marketplace page in the ACK console
Install ack-ingress-nginx-v1 for each NGINX Ingress controller deployed by installing ack-ingress-nginx. For more information, see Deploy multiple Ingress controllers in a cluster.
Do not set the value of the controller.ingressClassResource.name parameter in ack-ingress-nginx-v1 to the value of the controller.ingressClass parameter in ack-ingress-nginx. Otherwise, the NGINX Ingress controller may not run as expected due to Ingress class conflicts.
(Optional) Modify the SLB specification and parameters
If you have modified the Server Load Balancer (SLB) specification or parameters in ack-ingress-nginx, you may want to migrate the modifications to ack-ingress-nginx-v1. To do this, configure the controller.service
annotation (for Internet-facing SLB instances) or the controller.service.internal
annotation (for internal-facing SLB instances) annotation in ack-ingress-nginx-v1 to configure a LoadBalancer Service. For more information about how to configure Service annotations, see Use annotations to configure CLB instances and Use annotations to configure NLB instances.
Step 2: Create a new Ingress and test whether ack-ingress-nginx-v1 can route traffic as expected
After you install ack-ingress-nginx-v1, create a new Ingress based on the configuration of the original Ingress. Modify the Ingress class that is specified in the Ingress. Example of the original Ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: nginx-intranet # The Ingress class specified in the original Ingress is nginx-intranet.
spec:
rules:
- host: test-ingress.com
http:
paths:
- path: /foo
backend:
service:
name: web1-service
port:
number: 8080
pathType: ImplementationSpecific
- path: /bar
backend:
service:
name: web1-service
port:
number: 8080
pathType: ImplementationSpecific
Create a new Ingress.
If the Ingress class is specified by using an annotation, you need to modify the name of the Ingress class, but do not modify other annotations.
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: test-ingress-v1 # Create a new Ingress. namespace: default annotations: kubernetes.io/ingress.class: nginx-intranet-v1 # Change the name of the Ingress class to the Ingress class name used by nginx-intranet-v1. In this example, the Ingress class name is nginx-intranet-v1. spec: rules: - host: test-ingress.com http: paths: - path: /foo backend: service: name: web1-service port: number: 8080 pathType: ImplementationSpecific - path: /bar backend: service: name: web1-service port: number: 8080 pathType: ImplementationSpecific
If the Ingress class is specified by using the
spec.ingressClassName
parameter, repeat the preceding steps to create a new Ingress and change the value of thespec.ingressClassName
parameter in the new Ingress.
After you create the new Ingress, you can configure the hosts file to map the domain name to the IP address of the new Classic Load Balancer (CLB) instance. Then, test whether ack-ingress-nginx-v1 can route traffic as expected.
Step 3: Switch traffic to ack-ingress-nginx-v1
After you confirm that ack-ingress-nginx-v1 can route traffic as expected, modify DNS resolution settings to switch traffic to ack-ingress-nginx-v1.
Log on to the Alibaba Cloud DNS console or the console where you can configure resolution settings for the domain name that you use and map the domain name to the IP address of the new CLB instance. The modification to DNS resolution settings takes effect after a period of time. We recommend that you pay attention to your business during this period in case errors occur. You can view the container logs and metrics to monitor the progress of the switchover.
What to do next
After you confirm that the traffic is completely switched to ack-ingress-nginx-v1 and your business can be accessed as expected, uninstall ack-ingress-nginx. Log on to the ACK console. Select your cluster and go to the cluster details page. In the left-side navigation pane, choose . Find the Helm release that is named ack-ingress-nginx and click Delete in the Actions column.