I have to create a Kubernetes cluster in MS Azure manually, not using AKS. So:
- I've created 2 VM's in one Availability set: one for k8s master and second for k8s node.
- I've created External Load Balancer and add 2 VM's to the backend pool.
- I've created k8s cluster using kubespray.
I've created Deployment and LoadBalancer Service:
apiVersion: apps/v1beta1 kind: Deployment metadata: name: wrapper spec: replicas: 2 template: metadata: labels: app: wrapper spec: containers: - name: wrapper image: wrapper:latest ports: - containerPort: 8080 name: wrapper --- apiVersion: v1 kind: Service metadata: name: wrapper spec: loadBalancerIP: <azure_loadbalancer_public_ip> type: LoadBalancer ports: - port: 8080 selector: app: wrapper
But LoadBalancer service External-IP is always pending:
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP
wrapper LoadBalancer 10.233.38.7 <pending>
Also, telnet azure_loadbalancer_public_ip doesn't work. I've tried to use NodePort instead of LoadBalancer, but in that case, I have two endpoints for my service on k8s master and on k8s node.
What I want is one entrypoint: azure_loadbalancer_public_ip
, that is balances traffic between all nodes in the cluster.
Could you please help me to understand what I'm doing wrong and is it possible to "bind" Azure External Load Balancer with LoadBalancer service in Kubernetes?