apache / apisix-helm-chart

Apache APISIX Helm Chart
https://apisix.apache.org/
Apache License 2.0
232 stars 209 forks source link

How to specify a static IP on LoadBalancer in Azure #746

Open illflavored opened 8 months ago

illflavored commented 8 months ago

I'm looking for a way to specify my LoadBalancer IP while installing APISIX on AKS in Azure.

The official documentation shows us the general installation with a few overrides:

helm repo add apisix https://charts.apiseven.com
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
#  We use Apisix 3.0 in this example. If you're using Apisix v2.x, please set to v2
ADMIN_API_VERSION=v3
helm install apisix apisix/apisix \
  --set gateway.type=LoadBalancer \
  --set ingress-controller.enabled=true \
  --create-namespace \
  --namespace ingress-apisix \
  --set ingress-controller.config.apisix.serviceNamespace=ingress-apisix \
  --set ingress-controller.config.apisix.adminAPIVersion=$ADMIN_API_VERSION
kubectl get service --namespace ingress-apisix

The documentation continues to say:

The gateway service type will be set to LoadBalancer. You can find the load balancer IP address by running:

kubectl get service apisix-gateway --namespace ingress-apisix -o jsonpath='{.status.loadBalancer.ingress[].ip}'

This is fine perhaps for some non production scenarios, but it doesn't really give you control over which IP is being used. This can be a hassle for DNS. In addition, there's no guarantee of this dynamic IP. It's subject to changing if the LoadBalancer bounces or during upgrades. It could rotate to a new IP breaking DNS.

I'm looking for help with annotations or another configuration option to specify a pre-existing static Azure IP instead of rolling the dice and being at the mercy of dynamic IP rotation.

The NGINX ingress controller, by contrast has a fairly simple way of handling this with the following annotations.

  1. Create an AKS cluster
  2. Create a static IP address in Azure in the cluster's resource group
  3. Install or upgrade the NGINX helm chart with the specified load balancer IP
STATIC_IP=<your static IP here>

helm upgrade --install ingress-nginx ingress-nginx \
 --repo https://kubernetes.github.io/ingress-nginx \
 --namespace ingress-nginx \
 --create-namespace \
 --set rbac.create=true \
 --set controller.stats.enabled=true \
 --set controller.metrics.enabled=true \
 --set controller.service.externalTrafficPolicy="Local" \
 --set controller.service.loadBalancerIP=$STATIC_IP
Somaliadreams commented 1 month ago

This is also affecting us on migrating from Nginx Ingress towards APISIX.