I have an Kubernetes Cluster on Azure (AKS) running with NGINX as an ingress in front. The installation of Nginx was quite simple:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml
But by that, the Loadbalancer was created with a public IP. That's why I changed the service and added two annotations:
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
loadBalancerIP: 10.29.30.250
labels:
helm.sh/chart: ingress-nginx-3.10.1
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/version: 0.41.2
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: controller
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
type: LoadBalancer
externalTrafficPolicy: Local
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
- name: https
port: 443
protocol: TCP
targetPort: https
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/component: controller
Now the LoadblancerIP is private. But is not the IP from the annotations.
My Subnet: 10.29.30.240/28
Result:
$ sudo kubectl get svc --all-namespaces --watch
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
...
ingress-nginx ingress-nginx-controller LoadBalancer 10.0.125.51 10.29.30.248 80:30158/TCP,443:32714/TCP 57s
What I'm doing wrong?