EoinHanan
EoinHanan

Reputation: 77

Ingress hostname wont change

I have an Ingress setup and initially I used a placeholder name, "thesis.info". Now I would like change this hostname but whenever I to change it I just end up getting 404 errors.

  1. Change the spec.tls.rules.host value in the yaml to the new hostname
  2. Change CN value which openssl uses for the crt and key that are generated for TLS
  3. Edit the value /etc/hosts value on my local machine

Is there a step I am missing that could be causing a problem. I am baffled by why it works with one value but not the other.

Below is the ingress yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: frontend-ingress
  namespace: thesis
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/add-base-url: "true"
    nginx.ingress.kubernetes.io/service-upstream: "true"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  tls:
    - hosts:
        - thesis
      secretName: ingress-tls
  rules:
    - host: pod1out.ie
      http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: frontend
              port:
                number: 3000
---

Upvotes: 0

Views: 2505

Answers (1)

antaxify
antaxify

Reputation: 342

Most likely, you can find a hint on what is going on in the nginx logs. If you have access, you can access the logs using something like this:

kubectl -n <ingress-namespace> get pods 
# should be one or more nginx pods
kubectl -n <ingress-namespace> logs <nginx-pod>

Not sure if this is the only issue, but according to the documentation, the host in 'tls' has to match explicitly the host in the rules:

spec:
  tls:
    - hosts:
        - pod1out.ie
      secretName: ingress-tls
  rules:
    - host: pod1out.ie

Before struggling with tls, I would recommend making the http route itself work (eg. by creating another ingress resource), and if this works with the host you want, go for tls.

Upvotes: 1

Related Questions