Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.2k views
in Technique[技术] by (71.8m points)

k8s使用ingress代理非集群ip地址

我有一个web服务,没有在集群中,想使用 ingress 代理

下面是我的 yaml 文件

apiVersion: v1
kind: Service
metadata:
  name: exsi-web
spec:
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 443
  type: ClusterIP
---
apiVersion: v1
kind: Endpoints
metadata:
  name: exsi-web
subsets:
  - addresses:
      - ip: 192.168.1.102
    ports:
      - name: https
        port: 443
        protocol: TCP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: esxi-web
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - host: exsi.mrj.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: exsi-web
                port:
                  number: 443

但是却报错

  ~ k describe ing esxi-web
Name:             esxi-web
Namespace:        default
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host          Path  Backends
  ----          ----  --------
  exsi.mrj.com
                /   exsi-web:443   )
Annotations:    nginx.ingress.kubernetes.io/rewrite-target: /
Events:
  Type    Reason          Age   From                      Message
  ----    ------          ----  ----                      -------
  Normal  AddedOrUpdated  22m   nginx-ingress-controller  Configuration for default/esxi-web was added or updated

问题:

  1. 需要如何修改 ingress 的配置,才能正确发现 endpoint ?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...