简体   繁体   中英

Kubernetes Ingress Controller GPC GKE can't reach the site

Kube.netes Ingress Controller can't reach the site

Hi, this is the first time I am trying to deploy an application with kube.netes. The problem I am facing is I want to be able link subdomains with my svc, but when I try to navigate to the links I get

This site can't be reached

I will explain the steps I made for these, probably I something is wrong or missing

  1. I installed ingress-controller on google cloud platform

  2. In GCP -> Networking Services -> Cloud DNS

    a. I pointed testcompany.com with google dns

    b. I created an A record pointing the public IP from the previous step "ingress-nginx-controller"

  3. my svc manifest

    apiVersion: v1 kind: Service metadata: namespace: staging name: testcompany-svc labels: app: testcompany-svc spec: type: NodePort ports: - name: test-http port: 80 protocol: TCP targetPort: 3001 selector: app: testcompany
  4. my ingress manifest

    apiVersion:.networking.k8s.io/v1beta1 - host: api.testcompany.com http: paths: - backend: serviceName: testcompany-svc servicePort: test-http

Everything is green and it seems to be working, but when I try to reach the url I get the This site can't be reached


Update 1

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  namespace: staging
  name: ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: front.stagingtestcompany.com
    http:
      paths:
      - backend:
          serviceName: testcompanyfront-svc
          servicePort: testcompanyfront-http

  - host: api.stagingtestcompanysrl.com
    http:
      paths:
      - backend:
          serviceName: testcompanynodeapi-svc
          servicePort: testcompanyapi-http

You should check this, in order:

  1. your Service, Pod, Ingress are in the same namespace: kubectl get all -n staging
  2. your Pod is listening on port 3001: run it locally if you can, or use kubectl port-forward pods/[pod-name] -n staging 3001:3001 and try it locally with http://localhost:3001/...
  3. your Service is reaching your Pod correctly: use kubectl port-forward service/testcompany-svc -n staging 3001:3001 and try it locally with http://localhost:3001/...
  4. check any other Ingress spec rules before the one you posted
  5. check for firewall rules in your VPC.network, they should allow traffic from Google LBs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM