skip to Main Content
apiVersion: apps/v1
kind: Deployment
metadata:
  name: organization-deployment
  labels:
    app: organization
spec:
  selector:
    matchLabels:
      app: organization
  template:
    metadata:
      labels:
        app: organization
    spec:
      containers:
      - name: organization-container
        image: test.azurecr.io/organizationservice:latest
        ports:
        - containerPort: 9080
      imagePullSecrets:
      - name: guidesecret
      
# service type loadbalancer       
---
apiVersion: v1
kind: Service
metadata:
  name: organization-service
spec:
  type: LoadBalancer
  selector:
    app: organization
  ports:
  - protocol: TCP
    port: 9080
    targetPort: 9080

Here is my deployment.yaml file for AKS but i am unable to access pod using external ip with the port 9080.

Can anyone suggest how to access the pod using external ip and anyone review my Deployment file if it’s fine how to access pod using external ip?

kubectl get svc

kubectl describe svc

3

Answers


  1. Chosen as BEST ANSWER

    It was because of Kestrel HTTP2 Protocol which is not supported by aks


  2. Provided information seems to be not consistent. There is one service with ClusterIP type and the other one is LoadBalancer type. Better to recheck your deployments and services. Then provide valid details.

    Login or Signup to reply.
  3. I have verified your deployment and from validation point of view, there is nothing wrong with your deployment. I have tried to open the pod with loadbalancer ip and port and it gave me error 20.86.199.83 took too long to respond. So I assume there is something wrong with your application. In order to troubleshoot it, try to open the application directly using kubectl port forward. If the page opens, there is some issue with service. Otherwise you have to check from application.
    Check if application is running on port 9080.
    Exec into application pod shell.

    kubectl exec -it {pod-name} /bin/bash
    netstat -tulpan | grep -i :9080
    

    If the above command retuns true, means application is listening on port 9080.

    Exit from pod shell and do kubectl port-forward and check if application page opens up in browser.

    kubectl port-forward pods/{pod-name} 9080:9080
    

    Open page localhost:9080

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search