Recommand · November 24, 2021 0

kubernetes 503 ingress error service temporarily unavailable

I have the kubernetes with the configuration below, I’m new to DevOps and have been looking at:

  1. Kubernetes ingress-nginx gives 502 error (Bad Gateway)
  2. kubernetes ingress always return 503
  3. 502 Bad Gateway with Kubernetes Ingress
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <my-app>
spec:
  selector:
    matchLabels:
      app: <my-app>
  replicas: 1
  template:
    metadata:
      labels:
        app: <my-app>
    spec:
      containers:
        - name: <my-app>
          image: <hosted-repostory>/<my-app>:1.15.0
          imagePullPolicy: Always
          env:
            - name: SINGLE_USER_CREDENTIALS_USERNAME
              value: admin
            - name: SINGLE_USER_CREDENTIALS_PASSWORD
              value: adminadminadmin
          ports:
            - containerPort: 8443
          volumeMounts:
      volumes:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: <my-app>
  annotations:
spec:
  rules:
  - host: <DNS entry pointing to cluster loadbalancer>
    http:
      paths:
        - path: /
          backend:
            serviceName: <my-app>
            servicePort: 8443

apiVersion: v1
kind: Service
metadata:
  labels:
    app: <my-app>
  name: <my-app>
spec:
  type: NodePort
  ports:
  - port: 8443
    name: <my-app>
    protocol: TCP
    targetPort: 8443
  selector:
    app: <my-app>
status:
  loadBalancer: {}

I’ve based this deployment from how it is described here: https://github.com/apache/nifi/tree/main/nifi-docker/dockerhub

docker run --name nifi \
  -p 8443:8443 \
  -d \
  -e SINGLE_USER_CREDENTIALS_USERNAME=admin \
  -e SINGLE_USER_CREDENTIALS_PASSWORD=adminadminadmin \
  apache/nifi:latest

Tested using RKE on aws ec2 home lab.

I’ve looked into Nifi Docs, I’ve tired to set the node port (between 30000-32767) in the Service and then and parsing the environment variable as name: nifi.web.proxy.host value: <DNS>:<Port> and other NiFi specific configurations such as https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#cluster_node_properties
I’m not sure this required for a 1-node deployment, I suspect my problem is that I’m mis-configured some kubernetes fundamentals.

Edit: further explanation