Ingress -> Cluster IP back-end - got ERR_CONNECTION_REFUSED

旧巷老猫 提交于 2021-01-29 08:34:50

问题


I got ingress defined as:

  apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: wp-ingress
      namespace: wordpress
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/ssl-redirect: "true"
        nginx.ingress.kubernetes.io/proxy-body-size: 25m
    spec:
      rules:
        - host: my.domain.com
          http:
            paths:
              - path: /
                backend:
                  serviceName: wordpress
                  servicePort: 6002

And the back-end, defined as Cluster IP running on 6002 port.

When I am trying to reach ingress by its ADDRESS in the browser I get ERR_CONNECTION_REFUSED.

I suspect it has to do with the back-end?

Q: What could be a problem? How to analyse it? to make it work.

See the picture below, it is on GCP, all ips are resolved. All seems connected to each other.

The nginx-ingress (ingress-controller, default backed) was installed as helm chart.

helm install --namespace wordpress --name wp-nginx-ingress stable/nginx-ingress   --tls   

UPDATE:

I do not use yet (https) for back-end, tried to remove http redirect from the ingress yml: nginx.ingress.kubernetes.io/ssl-redirect: "true" removed - did not help.

UPDATE2: wordpress yaml - got from running service at yaml tab in GCP->KE->Services

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2020-03-30T04:11:12Z"
  labels:
    app.kubernetes.io/instance: wordpress
    app.kubernetes.io/managed-by: Tiller
    app.kubernetes.io/name: wordpress
    helm.sh/chart: wordpress-9.0.4
  name: wordpress
  namespace: wordpress
  resourceVersion: "2518308"
  selfLink: /api/v1/namespaces/wordpress/services/wordpress
  uid: 7dac1a73-723c-11ea-af1a-42010a800084
spec:
  clusterIP: xxx.xx.xxx.xx
  ports:
  - name: http
    port: 6002
    protocol: TCP
    targetPort: http
  - name: https
    port: 443
    protocol: TCP
    targetPort: https
  selector:
    app.kubernetes.io/instance: wordpress
    app.kubernetes.io/name: wordpress
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

UPDATE: 3

I tried:

  1. kubectl -n wordpress exec -it wordpress-xxxx-xxxx -- /bin/bash
  2. curl http://wordpress.wordpress.svc.cluster.local:6002 and it works - it gets me the html from the wordpress.

来源:https://stackoverflow.com/questions/60923601/ingress-cluster-ip-back-end-got-err-connection-refused

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!