503 Service Temporarily Unavailable after successful deployment - Kubernetes

11/19/2020

I deployed my app to kubernetes. while I try to access the app, I get the below message in browser:

Service unavailable while accesing the url from browser

And here is my aks-deployment yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: #{REPLICAS_COUNT}#
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 5000
        runAsGroup: 5000        

      containers:
      - name: myapp
        image: lcsacr.azurecr.io/tsshc:#{DOCKER_TAG}#
        env:
        - name: PORT
          value: "80"
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 1000m
            memory: 1024Mi
      imagePullSecrets:
        - name: aren-cr
---
apiVersion: v1
kind: Service
metadata:
  name: myapp
spec:
  type: ClusterIP
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 8080
  selector:
    app: myapp

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myapp-app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx-apps
spec:
  tls:
    - hosts:
      - mydevurl.net
      secretName: wildcard-apps 
  rules:
  - host: mydevurl.net
    http:
      paths:
        - path: /
          backend:
            serviceName: myapp
            servicePort: 80

Liveness and Readiness probes are as below:

livenessProbe:
          httpGet:
            path: /
            port: 8080
          failureThreshold: 5
          periodSeconds: 30

  readinessProbe:
          httpGet:
            path: /
            port: 8080
          failureThreshold: 2
          periodSeconds: 30

Describe pod output is as below:

Describe pod

I have done extensive googling with no luck. Could someone kindly point out what can be the cause for this 503 service unavailable?

-- user264953
azure-aks
kubernetes
kubernetes-ingress
kubernetes-pod
nginx-ingress

0 Answers