Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes Openshift-重命名路由_Kubernetes_Openshift - Fatal编程技术网

Kubernetes Openshift-重命名路由

Kubernetes Openshift-重命名路由,kubernetes,openshift,Kubernetes,Openshift,如何重命名通过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: -

如何重命名通过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
我收到以下错误消息:

无法处理资源。 原因:路由“测试”无效:spec.host:无效值:“old.test.site”:字段不可变

如文所述:


据我所知,您无法为现有路由就地编辑主机。从命令行重试

oc get route test -o yaml > route.yaml
然后编辑
route.yaml
并运行

oc replace route test -f route.yaml 
replace
操作可能允许您执行此操作。 否则在编辑本地副本后,请重试

oc delete route test

在执行此操作时,编辑文件时,可以删除整个
状态
部分


但是请记住,有些字段是必需的,您不能删除它们。这就是为什么你在修改上有问题

据我所知,您无法为现有路由就地编辑主机。从命令行中尝试
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
。在此过程中,编辑文件时,您可以删除整个
状态
部分。感谢您的回复。但编辑主机的正确方式是什么?我的意思是,替换
host
的值是否可以?
oc apply route test -f route.yaml