修补入口资源不会返回任何更改



我有两个helm部署(节点应用程序蓝色helm图表节点应用程序绿色helm图表(,我的入口资源是独立的,如下所示:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-resource
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: node-app-blue-helm-chart
servicePort: 80

尝试使用以下命令修补入口资源:

kubectl patch ingress ingress-resource --type=json 
-p='[{"op": "replace", "path": "/spec/rules/0/http/paths/0/backend/serviceName", "value":"node-app-green-helm-chart"}]'

返回无变化:

ingress.networking.k8s.io/ingress-resource patched (no change)

描述资源:

$ kubectl describe ingress ingress-resource
Name:             ingress-resource
Namespace:        default
Address:          -----
Default backend:  default-http-backend:80 (10.72.0.6:8080)
Rules:
Host        Path  Backends
----        ----  --------
*           
/   node-app-blue-helm-chart:80 (10.72.0.46:80)
Annotations:  kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: false
Events:       <none>

缺少什么?

serviceName不是最新的表示形式。将其更改为服务/名称解决了问题。

$ kubectl patch ingress ingress-resource --type=json 
-p='[{"op": "replace", "path": "/spec/rules/0/http/paths/0/backend/service/name", "value":"node-app-green-helm-chart"}]'
ingress.networking.k8s.io/ingress-resource patched

相关内容

  • 没有找到相关文章

最新更新