Good guys Let's see if someone can help me. I have configured Azure Kubernetes (AKS) in version 1.13 I am trying to create an Ingress with static IP, but it is impossible for me.
I am use kubectl create -f static-ip-svc.yaml
#File
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress-lb
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
loadBalancerIP: 40.121.219.126
ports:
- port: 80
name: http
targetPort: 80
- port: 443
name: https
targetPort: 443
selector:
# Selects nginx-ingress-controller pods
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
and show error:
Type Reason Age From
Message ---- ------ ---- ---- ------- Normal EnsuringLoadBalancer 8s (x4 over 43s) service-controller Ensuring load balancer Warning CreatingLoadBalancerFailed 7s (x4 over 43s) service-controller Error creating load balancer (will retry): failed to ensure load balancer for service default/nginx-ingress-lb: timed out waiting for the condition
For you, to create an Ingress with static IP, there are two ways to achieve it. But firstly, you need to know the info that resource groups for Azure Kubernetes service and its infrastructure.
The info is Why are two resource groups created with AKS? It explains that there are two resource groups, one for the Azure Kubernetes service itself and another for its infrastructure. So that there are two ways to create an Ingress with static IP.
Here the two ways:
Use the static IP which created in the group named MC_xxxx_xxxx_location
.
Use the static IP which created in another group except for the group MC_xxxx_xxxx_location
. In this way, you need to assign enough permission to the service principal of AKS, at least is "Network Contributor".
You get more details about "Use a static public IP address with the Azure Kubernetes Service (AKS) load balancer" here. I think you use the second way but you do not assign enough permission so that you got the error. Check the steps and try again following the steps.