0

I have a Kops cluster running on AWS and am trying to use nginx-ingress to create an NLB which will route traffic to my two subdomains for an application. So far I have been able to get it to create the NLB and the ingress creates however it doesn't allow me to route traffic to the NLB directly nor via setting up a DNS record for api.dev.mydomain.ca.

Below are my manifest files, I am hoping someone will be able to look at them and see something wrong. So far logs have shown me nothing of interest or just nothing at all in some cases. It seems like my NLB is created and must be routing traffic in some way because I don't get any error messages just that the tab is loading forever and eventually times out - I am guessing it is Chrome timing out.

What am I missing that is causing my NLB to not route traffic and not get an SSL cert via cert manager?

ingress.yaml

apiVersion: networking.k8s.io/v1beta1
# apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    # add an annotation indicating the issuer to use.
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "letsencrypt-stage"
    # needed to allow the front end to talk to the back end
    nginx.ingress.kubernetes.io/cors-allow-origin: "https://api.dev.mydomain.ca"
    nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "GET, PUT, POST, DELETE, PATCH, OPTIONS"
    # needed for monitoring - maybe
    prometheus.io/scrape: "true"
    prometheus.io/port: "10254"
    #for nginx ingress controller
    ad.datadoghq.com/nginx-ingress-controller.check_names: '["nginx","nginx_ingress_controller"]'
    ad.datadoghq.com/nginx-ingress-controller.init_configs: '[{},{}]'
    ad.datadoghq.com/nginx-ingress-controller.instances: '[{"nginx_status_url": "http://%%host%%:18080/nginx_status"},{"prometheus_url": "http://%%host%%:10254/metrics"}]'
    ad.datadoghq.com/nginx-ingress-controller.logs: '[{"service": "controller", "source":"nginx-ingress-controller"}]'
  name: nginx-ingress
  namespace: mydomain
spec:
  rules:
  - host: api.dev.mydomain.ca
    http:
      paths:
      - backend:
          serviceName: express-api
          servicePort: 8090
        path: /
  - host: socket.dev.mydomain.ca
    http:
      paths:
      - backend:
          serviceName: socketio
          servicePort: 9000
        path: /
  # tls: # < placing a host in the TLS config will indicate a certificate should be created
  # - hosts:
  #   - api.dev.mydomain.ca
  #   secretName: express-ingress-cert # < cert-manager will store the created certificate in this secret
  # - hosts:
  #   - socket.dev.mydomain.ca
  #   secretName: socket-ingress-cert # < cert-manager will store the created certificate in this secret

Link to the nginx ingress setup file I am using https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.46.0/deploy/static/provider/aws/deploy.yaml

My letsencrypt.yaml file

apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: letsencrypt
  namespace: cert-manager
spec:
  commonName: me@mydomain.ca
  secretName: letsencrypt-tls
  issuerRef:
    name: letsencrypt
---
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
 name: letsencrypt
 namespace: cert-manager
spec:
 acme:
   # The ACME server URL
  #  server: https://acme-v02.api.letsencrypt.org/directory
   server: https://acme-staging-v02.api.letsencrypt.org/directory
   # Email address used for ACME registration
   email: me@mydomain.ca
   # Name of a secret used to store the ACME account private key
   privateKeySecretRef:
     name: letsencrypt-stage
   # Enable the HTTP-01 challenge provider
   solvers:
   - http01:
       ingress:
         class:  nginx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.