Service Deployed on kubernetes is not accessible by internet

12/16/2020

I have deployed a service on azure kubernetes service I get this when I run kubectl get service -n dev

Myservice      LoadBalancer   10.0.115.231   20.xxx.xx.xx     8080:32475/TC

But when I try to open my application with 20.xxx.xx.xx:8080 I am not able to access it.

What could be the issue? I am posting my deployment and service file below

apiVersion: apps/v1
kind: Deployment
metadata:
  name: Myservice
  namespace: dev
spec:
  replicas: 1
  selector:
    matchLabels:
      app: Myservice
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  template:
    metadata:
      labels:
        app: MyService
    spec:
      nodeSelector:
        "beta.kubernetes.io/os": linux
      containers:
      - name: MyService
        image: image_url:v1
        ports:
        - containerPort: 8080
        resources:
          requests:
            cpu: 250m
          limits:
            cpu: 500m


apiVersion: v1
kind: Service
metadata:
  name: myservice
  namespace: dev-lifestyle
spec:
  type: LoadBalancer
  ports:
  - port: 8080
  selector:
    app: myservice

My pods are in running state.

 Name:                    myservice
Namespace:                dev-lifestyle
Labels:                   <none>
Annotations:              <none>
Selector:                 myservice
Type:                     LoadBalancer
IP Families:              <none>
IP:                       10.0.xx.xx
IPs:                      <none>
LoadBalancer Ingress:     20.xxx.xx.xx
Port:                     <unset>  8080/TCP
TargetPort:               8080/TCP
NodePort:                 <unset>  32475/TCP
Endpoints:                172.xx.xx.xx:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
-- Akshay Jindal
azure
azure-aks
kubernetes

1 Answer

12/16/2020

Check that 8080 is open in security groups in azure

-- Vladimir Baranov
Source: StackOverflow