OpenShift修补程序服务端口号
在OpenShift中,我试图使用此命令通过OpenShift客户端可执行文件修补服务端口号,但收到此错误消息OpenShift修补程序服务端口号,openshift,openshift-client-tools,Openshift,Openshift Client Tools,在OpenShift中,我试图使用此命令通过OpenShift客户端可执行文件修补服务端口号,但收到此错误消息 $ oc patch svc fabric-boot-sample -p '{"spec":{"ports":{"port":8090}}}' Error from server: cannot restore slice from map 该补丁以yaml服务描述符的这一部分为目标 $ oc get svc/fabric-boot-sample -o yaml ... spec:
$ oc patch svc fabric-boot-sample -p '{"spec":{"ports":{"port":8090}}}'
Error from server: cannot restore slice from map
该补丁以yaml服务描述符的这一部分为目标
$ oc get svc/fabric-boot-sample -o yaml
...
spec:
clusterIP: 172.30.48.46
ports:
- name: 8090-tcp
port: 8090
protocol: TCP
targetPort: 8090
...
patch命令中是否存在某些键入/语法错误?问题在于您要针对的
端口是一个列表。因此,您需要指定要修补列表中的哪个元素
如果确定列表中只有一个元素可以运行:
oc patch svc fabric boot sample--type=json-p'[{“op”:“replace”,“path”:“/spec/ports/0/port”,“value”:9999}]”
如果您正在更新一个没有使用ports:{}
指定端口的服务,也会发生这种情况。您能否在yaml中提供一个示例,说明如何指定要修补列表中的元素?