|
| 1 | +--- |
| 2 | +title: Migrate from HTTP application routing to the application routing add-on |
| 3 | +description: Learn how to migrate from the HTTP application routing feature to the application routing add-on. |
| 4 | +ms.topic: how-to |
| 5 | +ms.author: nickoman |
| 6 | +author: nickomang |
| 7 | +ms.custom: devx-track-azurecli, devx-track-linux |
| 8 | +ms.date: 08/18/2023 |
| 9 | +--- |
| 10 | + |
| 11 | +# Migrate from HTTP application routing to the application routing add-on |
| 12 | + |
| 13 | +In this article, you'll learn how to migrate your Azure Kubernetes Service (AKS) cluster from HTTP application routing feature to the [application routing add-on](./app-routing.md). The HTTP application routing add-on has been retired and won't work on any cluster Kubernetes version currently in support, so we recommend migrating as soon as possible to maintain a supported configuration. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions to [Install Azure CLI][install-azure-cli]. Run `az --version` to find the version, and run `az upgrade` to upgrade the version if not already on the latest. |
| 18 | + |
| 19 | +> [!NOTE] |
| 20 | +> These steps detail migrating from an unsupported configuration. As such, AKS cannot offer support for issues that arise during the migration process. |
| 21 | +
|
| 22 | +## Update your cluster's add-ons, ingresses, and IP usage |
| 23 | + |
| 24 | +1. Enable the application routing add-on. |
| 25 | + |
| 26 | + ```azurecli-interactive |
| 27 | + az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons web_application_routing |
| 28 | + ``` |
| 29 | +
|
| 30 | +2. Update your ingresses, setting `ingressClassName` to `webapprouting.kubernetes.azure.com`. Remove the `kubernetes.io/ingress.class` annotation. You'll also need to update the host to one that you own, as the application routing add-on doesn't have a managed cluster DNS zone. If you don't have a DNS zone, follow instructions to [create][app-routing-dns-create] and [configure][app-routing-dns-configure] one. |
| 31 | +
|
| 32 | + Initially, your ingress configuration will look something like this: |
| 33 | +
|
| 34 | + ```yaml |
| 35 | + apiVersion: networking.k8s.io/v1 |
| 36 | + kind: Ingress |
| 37 | + metadata: |
| 38 | + name: aks-helloworld |
| 39 | + annotations: |
| 40 | + kubernetes.io/ingress.class: addon-http-application-routing # Remove the ingress class annotation |
| 41 | + spec: |
| 42 | + rules: |
| 43 | + - host: aks-helloworld.<CLUSTER_SPECIFIC_DNS_ZONE> |
| 44 | + http: |
| 45 | + paths: |
| 46 | + - path: / |
| 47 | + pathType: Prefix |
| 48 | + backend: |
| 49 | + service: |
| 50 | + name: aks-helloworld |
| 51 | + port: |
| 52 | + number: 80 |
| 53 | + ``` |
| 54 | +
|
| 55 | + After you've properly updated, the same configuration will look like the following: |
| 56 | +
|
| 57 | + ```yaml |
| 58 | + apiVersion: networking.k8s.io/v1 |
| 59 | + kind: Ingress |
| 60 | + metadata: |
| 61 | + name: aks-helloworld |
| 62 | + spec: |
| 63 | + ingressClassName: webapprouting.kubernetes.azure.com # Set the ingress class property to refer to the application routing add-on ingress class |
| 64 | + rules: |
| 65 | + - http: |
| 66 | + host: aks-helloworld.<CLUSTER_SPECIFIC_DNS_ZONE> # Replace with your own hostname |
| 67 | + paths: |
| 68 | + - path: / |
| 69 | + pathType: Prefix |
| 70 | + backend: |
| 71 | + service: |
| 72 | + name: aks-helloworld |
| 73 | + port: |
| 74 | + number: 80 |
| 75 | + ``` |
| 76 | +
|
| 77 | +3. Update the ingress controller's IP (such as in DNS records) with the new IP address. You can find the new IP by using `kubectl get`. For example: |
| 78 | +
|
| 79 | + ```bash |
| 80 | + kubectl get svc nginx --namespace app-routing-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}' |
| 81 | + ``` |
| 82 | +
|
| 83 | +4. Disable the HTTP application routing add-on. |
| 84 | +
|
| 85 | + ```azurecli-interactive |
| 86 | + az aks disable-addons -g <ResourceGroupName> -n <ClusterName> --addons http_application_routing |
| 87 | + ``` |
| 88 | +
|
| 89 | +## Remove and delete all HTTP application routing resources |
| 90 | +
|
| 91 | +1. After the HTTP application routing add-on is disabled, some related Kubernetes resources may remain in your cluster. These resources include *configmaps* and *secrets* that are created in the *kube-system* namespace. To maintain a clean cluster, you may want to remove these resources. Look for *addon-http-application-routing* resources using the following [`kubectl get`][kubectl-get] commands: |
| 92 | +
|
| 93 | + ```bash |
| 94 | + kubectl get deployments --namespace kube-system |
| 95 | + kubectl get services --namespace kube-system |
| 96 | + kubectl get configmaps --namespace kube-system |
| 97 | + kubectl get secrets --namespace kube-system |
| 98 | + ``` |
| 99 | +
|
| 100 | + The following example output shows *configmaps* that should be deleted: |
| 101 | +
|
| 102 | + ```output |
| 103 | + NAMESPACE NAME DATA AGE |
| 104 | + kube-system addon-http-application-routing-nginx-configuration 0 9m7s |
| 105 | + kube-system addon-http-application-routing-tcp-services 0 9m7s |
| 106 | + kube-system addon-http-application-routing-udp-services 0 9m7s |
| 107 | + ``` |
| 108 | +
|
| 109 | +1. Delete remaining resources using the [`kubectl delete`][kubectl-delete] command. Make sure to specify the resource type, resource name, and namespace. The following example deletes one of the previous configmaps: |
| 110 | +
|
| 111 | + ```bash |
| 112 | + kubectl delete configmaps addon-http-application-routing-nginx-configuration --namespace kube-system |
| 113 | + ``` |
| 114 | +
|
| 115 | +1. Repeat the previous `kubectl delete` step for all *addon-http-application-routing* resources remaining in your cluster. |
| 116 | +
|
| 117 | +## Next steps |
| 118 | +
|
| 119 | +After migrating to the application routing add-on, learn how to [monitor ingress controller metrics with Prometheus and Grafana](./app-routing-nginx-prometheus.md). |
| 120 | +
|
| 121 | +<!-- INTERNAL LINKS --> |
| 122 | +[install-azure-cli]: /cli/azure/install-azure-cli |
| 123 | +[ingress-https]: ./ingress-tls.md |
| 124 | +[app-routing-dns-create]: ./app-routing.md?tabs=without-osm#create-an-azure-dns-zone |
| 125 | +[app-routing-dns-configure]: ./app-routing.md?tabs=without-osm#configure-the-add-on-to-use-azure-dns-to-manage-dns-zones |
| 126 | +
|
| 127 | +<!-- EXTERNAL LINKS --> |
| 128 | +[dns-pricing]: https://azure.microsoft.com/pricing/details/dns/ |
| 129 | +[kubectl-get]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get |
| 130 | +[kubectl-delete]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#delete |
0 commit comments