修补入口资源 returns 无变化
Patching Ingress Resource returns no change
我有 2 个 helm 部署(node-app-blue-helm-chart node-app-green-helm-chart),我的入口资源是独立的,像这样:
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"}]'
Returns 无变化:
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 不是最近的表示。将其更改为 service/name 已解决问题。
$ 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
我有 2 个 helm 部署(node-app-blue-helm-chart node-app-green-helm-chart),我的入口资源是独立的,像这样:
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"}]'
Returns 无变化:
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 不是最近的表示。将其更改为 service/name 已解决问题。
$ 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