Search code examples
nestjsazure-aksacr

I am trying to deploy my docker image from ACR to AKS. The pods are getting created properly but getting ERR_CONNECTION_TIMED_OUT through external IP


The same deployment and service yaml files are working properly when I am using a standard image from docker like nginx and set it's containerPort to default port of nginx i.e. 80 but when I am changing it's container port to 8080 then also I am getting the same issue.

My deployment.yaml file -

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-test-deployment
  labels:
    app: my-test-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-test-app
  template:
    metadata:
      labels:
        app: my-test-app
    spec:
      containers:
      - name: my-test-container
        image: javapoccr.azurecr.io/sushant-saurav/my-nest-app-with-docker
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8080
      imagePullSecrets:
      - name: acr-details

My service.yaml -

apiVersion: v1
kind: Service
metadata:
  name: my-test-service
  labels:
    app: my-test-app
spec:
  selector:
    app: my-test-app
  type: LoadBalancer
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080

Solution

  • There are two quick things that I would check/verify:

    1. Is the test app configured to listen on 8080? The containerPort/targetPort should match what the app is configured to listen on.
    2. Ensure that you have the most recent image. Without a tag, you are using :latest. But if you update that, the imagePullPolicy will not pull the new image, if it has an older one. I'd recommend changing the imagePullPolicy to Always

    -Dave