Why unable to access Azure aks Service external IP with browser?

1/20/2022
apiVersion: apps/v1
kind: Deployment
metadata:
  name: farwell-helloworld-net3-webapi
spec:
  replicas: 1
  selector:
    matchLabels:
      app: farwell-helloworld-net3-webapi
  template:
    metadata:
      labels:
        app: farwell-helloworld-net3-webapi
    spec:
      nodeSelector:
        "kubernetes.io/os": linux
      containers:
      - name: farwell-helloworld-net3-webapi
        image: devcontainerregistry.azurecr.cn/farwell.helloworld.net3.webapi:latest
        env:
        - name: ALLOW_EMPTY_PASSWORD
          value: "yes"
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
        ports:
        - containerPort: 8077
---
apiVersion: v1
kind: Service
metadata:
  name: farwell-helloworld-net3-webapi
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: 8077
  selector:
    app: farwell-helloworld-net3-webapi

I use this command: kubectl get service farwell-helloworld-net3-webapi --watch then i get this:

NAME                             TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)        AGE
farwell-helloworld-net3-webapi   LoadBalancer   10.0.116.13   52.131.xxx.xxx   80:30493/TCP   13m

I have already open the azure port 80.But I cannot access http://52.131.xxx.xxx/WeatherForecast

Could you help me pls? or tell me some steps to help to find the reason?

-- Farwell_Liu
azure
azure-aks
kubernetes

1 Answer

1/21/2022

It seems that I changed the port number from 8077 to 80, then it runs well.

-- Farwell_Liu
Source: StackOverflow