<p>I have created the Kubernetes Cluster using two Azure Ubuntu VMs. I am able to deploy and access pods and deployments using the Nodeport service type. I have also checked the pod's status in <code>Kube-system</code> namespace. All of the pod's status showing as <code>running</code>. but, whenever I mention service type to Loadbalancer, it was not creating the LoadBalancer IP and it's status always showing as <code>pending</code>. I have also created an Ingress controller for the Nginx service. still, it is not creating an ingress Address.  While initializing the Kubernetes master, I am using the following command.</p>
<p><code>kubeadm init</code></p>
<p>Below is deployment, svc and Ingress manifest files.</p>
<pre><code>apiVersion: apps/v1 
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3 
  template: 
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
---
 apiVersion: networking.k8s.io/v1beta1
 kind: Ingress
 metadata:
   name: test-ingress
 spec:
   backend:
     serviceName: nginx
     servicePort: 80
</code></pre>
<pre><code>$ kubectl describe svc nginx

 Name:              nginx
 Namespace:         default
 Labels:            app=nginx
 Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {&quot;apiVersion&quot;:&quot;v1&quot;,&quot;kind&quot;:&quot;Service&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;labels&quot;:{&quot;app&quot;:&quot;nginx&quot;},&quot;name&quot;:&quot;nginx&quot;,&quot;namespace&quot;:&quot;default&quot;},&quot;spec&quot;:{&quot;p...
 Selector:          app=nginx
 Type:              ClusterIP
 IP:                10.96.107.97
 Port:              http  80/TCP
 TargetPort:        80/TCP
 Endpoints:         10.44.0.4:80,10.44.0.5:80,10.44.0.6:80
 Session Affinity:  None
 Events:            &lt;none&gt;
</code></pre>
<pre><code>$ kubectl describe ingress nginx
Name:             test-ingress
Namespace:        default
Address:
Default backend:  nginx:80 (10.44.0.4:80,10.44.0.5:80,10.44.0.6:80)
Rules:
  Host  Path  Backends
  ----  ----  --------
  `*`     `*`     nginx:80 (10.44.0.4:80,10.44.0.5:80,10.44.0.6:80)
Annotations:
  kubectl.kubernetes.io/last-applied-configuration:  {&quot;apiVersion&quot;:&quot;networking.k8s.io/v1beta1&quot;,&quot;kind&quot;:&quot;Ingress&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;test-ingress&quot;,&quot;namespace&quot;:&quot;default&quot;},&quot;spec&quot;:{&quot;backend&quot;:{&quot;serviceName&quot;:&quot;nginx&quot;,&quot;servicePort&quot;:80}}}
Events:  `&lt;none&gt;`
</code></pre>
<p>Do we need to mention any IP ranges(private or public) of VMs while initializing the kubeadm init? or
Do we need to change any network settings in Azure Ubuntu VMs?</p>

<p>As you created your own Kubernetes cluster rather than AWS, Azure or GCP provided one, there is no load balancer integrated. Due to this reason, you are getting IP status pending. </p>

<p>But with the use of Ingress Controller or directly through NodePort you can circumvent this problem. </p>

<p>However, I also observed in your <code>nginx service</code> you are using an annotation <code>service.beta.kubernetes.io/aws-load-balancer-type: nlb</code> and you said you are using <code>Azure</code> and those are platform specific annotations for the service and that annotation is AWS specific.</p>

<p>However, you can give something like this a try, if you would like to experiment directly with public IPs, you can define your service by providing <a href="https://kubernetes.io/docs/concepts/services-networking/service/#external-ips" rel="nofollow noreferrer"><code>externalIPs</code></a> in your service if you have a public ip allocated to your node and allows ingress traffic from somewhere.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 9376
  externalIPs:
    - 80.11.12.10
</code></pre>

<p>But, a good approach to get this done is using an <code>ingress controller</code> if you are planning to build your own Kubernetes cluster.</p>

<p>Hope this helps.</p>
