我有以下入口…
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: core-ingress
namespace: earth
annotations:
kubernetes.io/ingress.global-static-ip-name: "core-proxy-static-ip"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: core-ingress
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: core-proxy-service
port:
number: 80
我使用kubectl exec
来确保服务本身正在运行并在端口80上侦听,因此我知道core-proxy-service
正在工作。当我尝试安装入口时,它永远不会得到IP和事件显示什么…
Name: core-ingress
Namespace: earth
Address:
Default backend: default-http-backend:80 (10.109.128.78:8080)
Rules:
Host Path Backends
---- ---- --------
*
/ core-proxy-service:80 (10.109.128.132:80)
Annotations: kubernetes.io/ingress.global-static-ip-name: core-proxy-static-ip
nginx.ingress.kubernetes.io/rewrite-target: /
Events: <none>
由于没有事件,我认为一定发生了什么,这就是为什么我没有得到一个IP,但我如何能够调试找出什么?
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE
earth core-ingress core-ingress * 80 3m33s
更新如果我回到
defaultBackend:
service:
name: core-proxy-service
port:
number: 80
一切正常,我错过了什么?
试试这样写:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-myservicea
annotations:
kubernetes.io/ingress.global-static-ip-name: "core-proxy-static-ip"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
backend:
serviceName: core-proxy-service
servicePort: 80
Ref doc: https://kubernetes.github.io/ingress-nginx/user-guide/basic-usage/