Unable to connect to Azure Kubernetes (AKS) external-ip

5/12/2020

I'm trying to deploy my first asp.net app (sample VS 2019 project) to AKS.

I was able to create a docker container, run it locally and access it via http://localhost:8000/weatherforecast.

However, I'm not able to access the endpoint when it's deployed in AKS.

Yaml file:

apiVersion: apps/v1
kind: Deployment
metadata:
  <t/>name: aspnetdemo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aspnetdemo
  template:
    metadata:
      labels:
        app: aspnetdemo
    spec:
      containers:
      - name: mycr
        image: mycr.azurecr.io/aspnetdemo:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
---

apiVersion: v1
kind: Service
metadata:
  name: aspnetdemo-service
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: aspnetdemo
  type : LoadBalancer

I verified that the pod is running -

kubectl get pods 
NAME                                READY   STATUS    RESTARTS   AGE
aspnetdemo-deployment-*             2/2     Running   0          21m

and the service too -

kubectl get service
NAME                 TYPE           CLUSTER-IP   EXTERNAL-IP    PORT(S)        AGE
aspnetdemo-service   LoadBalancer   10.0.X.X     13.89.X.X      80:30635/TCP   22m

I am getting a error when I try to access 13.89.X.X/weatherforecast:

"this site can't be reached - the connection was reset"

Any ideas?

When I run the following command, it returns an endpoint -

kubectl describe service aspnetdemo-service | select-string Endpoints

Endpoints:                10.244.X.X:8080

I also tried port forwarding and that didn't work either.

kubectl port-forward service/aspnetdemo-service 3000:80
http://localhost:3000/weatherforecast
E0512 15:16:24.429387   21356 portforward.go:400] an error occurred forwarding 3000 -> 8080: error forwarding port 8080 to pod a87ebc116d0e0b6e7066f32e945661c50d745d392c76844de084c7da96a874b8, uid : exit status 1: 2020/05/12 22:16:24 socat[18810] E write(5, 0x14da4c0, 535): Broken pipe

Thanks in advance!

-- osiris
asp.net-core
azure-aks
kubernetes
yaml

0 Answers