gpt4 book ai didi

kubernetes - Openshift-重命名路线

转载 作者:行者123 更新时间:2023-12-02 12:06:52 24 4
gpt4 key购买 nike

如何重命名通过Web控制台创建的路由?
我转到Applications>Routes,选择路由名称,然后选择Action>Edit YAML,我想要实现以下更改,从test.site变为old.test.site
当前路线yml配置

...
metadata:
name: test
selfLink: /oapi/v1/namespaces/keycloak/routes/test
...
spec:
host: test.site
...
status:
ingress:
- conditions:
- lastTransitionTime: '2017-12-13T02:19:22Z'
status: 'True'
type: Admitted
host: test.site

尝试
...
metadata:
name: test
selfLink: /oapi/v1/namespaces/keycloak/routes/test
...
spec:
host: old.test.site
...
status:
ingress:
- conditions:
- lastTransitionTime: '2017-12-13T02:19:22Z'
status: 'True'
type: Admitted
host: old.test.site

我收到以下错误消息:

Failed to process the resource. Reason: Route "test" is invalid: spec.host: Invalid value: "old.test.site": field is immutable

最佳答案

正如Graham Dumpleton写道:

据我所知,您无法在现有路由中编辑主机。从命令行尝试

oc get route test -o yaml > route.yaml

然后编辑 route.yaml并运行
oc replace route test -f route.yaml 
replace操作可以允许您执行此操作。
否则,在编辑本地副本后,尝试
oc delete route test


oc apply route test -f route.yaml

为此,在编辑文件时,可以删除整个 status部分。

但是请记住,存在一些必填字段,您不能删除它们。这就是为什么您在修改时遇到问题。

关于kubernetes - Openshift-重命名路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51438773/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com