0

I have setup in my GKE cluster an nginx ingress as follows:

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace nginx-ingress

A load balancer with its IP came up.

Now I added two DNS pointing to that domain at Cloudflare:

enter image description here

In addition I created a namespace app-a

kubectl create namespace app-a
kubectl label namespace app-a project=a

and deployed an app there:

apiVersion: v1
kind: Service
metadata:
  name: echo1
  namespace: app-a
spec:
  ports:
  - port: 80
    targetPort: 5678
  selector:
    app: echo1
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo1
  namespace: app-a
spec:
  selector:
    matchLabels:
      app: echo1
  replicas: 2
  template:
    metadata:
      labels:
        app: echo1
    spec:
      containers:
      - name: echo1
        image: hashicorp/http-echo
        args:
        - "-text=echo1"
        ports:
        - containerPort: 5678
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: echo-ingress-global
  namespace: app-a
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: "test.my-domain.com"
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: echo1
              port:
                number: 80

Things look good in Lens, so I thought to test it out.

When I was entering eu1.my-domain.com, I get

enter image description here

which is intended, of course.

but when I entered test.my-domain.com, I get that the website is unreachable: DNS_PROBE_FINISHED_NXDOMAIN, although I expected to see the dummy output of the dummy app.

Even more strangely, no matter if I get the well-responding result or the non-responding one, in the logs of the nginx controller there is nothing showing up for any of the calls.

Can you help me, such that I can access the test.my-domain.com homepage?

tobias
  • 101

1 Answers1

1

Posting this as an answer since I do not have enough reputation to comment on your post.

The domain "my-domain.com" is a publicly registered domain. When doing a domain lookup, the public IP address displayed does not match the Cloudflare public IPs from the screenshots that you provided. It is assumed that you have your own registered domain name to use as your host on your service.yaml to run your GKE web app successfully.

You may refer to this documentation about using a domain name with your GKE cluster.