我有关于 Openshift Ingress 的问题
根据本文档 https://docs.openshift.com/container-platform/4.7/networking/routes/route-configuration.html#nw-ingress-creating-a-route-via-an-ingress_route-configuration路由应该是自动创建到我的服务。我做了以下创建的新项目:
oc new-project test-ingress
Run Code Online (Sandbox Code Playgroud)
部署的虚拟应用程序:
oc new-app openshift/hello-openshift
Run Code Online (Sandbox Code Playgroud)
然后创建 Ingress 对象(这次没有 TLS):
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-openshift
spec:
rules:
- host: hello-openshift.mycluster.example.com
http:
paths:
- backend:
# Forward to a Service called 'hello-openshift'
service:
name: hello-openshift
port:
number: 8080
path: /
pathType: Exact
Run Code Online (Sandbox Code Playgroud)
根据文档,我应该看到自动创建的服务路由。但路线没有创建。IBM Cloud 中的 Openshift 集群 v4.11。有人有同样的问题吗?
注意:在较旧的 Openshift 集群 v4.10 云上也存在同样的问题。但是当我从 更改为pathType: Exact-pathType: Prefix路线已生成。这不适用于 Openshift 集群 v4.11。有什么建议么?也许应该做一些我不知道的 Ingress 配置?
小智 6
在 4.12 上进行测试,当我在创建入口时添加 ingressClassName 时,我能够创建路由。
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: hello-openshift-class
namespace: shashi-ingress
spec:
ingressClassName: openshift-default <<<
rules:
- host: hello-openshift-class.apps.cs-ocp12.cp.fyre.abcd.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-openshift
port:
number: 8080
Run Code Online (Sandbox Code Playgroud)
定义了和没有定义 ingressClassName 的 ingress
oc get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
hello-openshift-class openshift-default hello-openshift-class.apps.cs-ocp12.cp.fyre.abcd.com router-default.apps.cs-ocp12.cp.fyre.abcd.com 80 81m
hello-openshift-noclass <none> hello-openshif-nodefaultt.cs-ocp12.cp.fyre.abcd.com
Run Code Online (Sandbox Code Playgroud)
路线已定义
oc get route
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
hello-openshift-class-qcf4d hello-openshift-class.apps.cs-ocp12.cp.fyre.abcd.com / hello-openshift 8080-tcp None
Run Code Online (Sandbox Code Playgroud)
参考:
OCP 4.12 安全增强功能,您会看到警报:对于任何未定义 ingressClassName 的现有入口,IngressWithoutClassName
希望能帮助到你
| 归档时间: |
|
| 查看次数: |
2057 次 |
| 最近记录: |