Kubernetes Load Balancer Terminating SSL to Reverse Proxy Ingress DigitalOcean

1/21/2020

I had my original infrastructure built around this tutorial. https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes.

Now I am trying to migrate to managing my own cert and terminating SSL at the load balancer.

With my YAML updates, the load balancer in DigitalOcean shows that all nodes are unhealthy and I the URL response with "503 Service Unavailable No server is available to handle this request." However, the endpoint shows a secure HTTPS connection. What am I doing wrong?

My new non-functional YAML definitions below.

LoadBalancer

apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-redirect-http-to-https: "true"
    service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
    service.beta.kubernetes.io/do-loadbalancer-certificate-id: "**************"
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: http

Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: "50m"
spec:
  tls:
    - hosts:
        - ******.com
        - api.*******.com
  rules:
    - host: **********.com
      http:
        paths:
          - backend:
              serviceName: frontend-angular
              servicePort: 80
    - host: api.********.com
      http:
        paths:
          - backend:
              serviceName: backend-server
              servicePort: 80
-- Joseph Horsch
digital-ocean
kubernetes
load-balancing
nginx-ingress
ssl

1 Answer

1/21/2020

I reached out to DigitalOcean support (which is incredible). My issue was I didn't create the ingress-nginx pod. These are the two steps, as listed in the tutorial, that I missed.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.26.1/deploy/static/mandatory.yaml

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.26.1/deploy/static/provider/cloud-generic.yaml.

My actual YAML definitions were correct.

-- Joseph Horsch
Source: StackOverflow