Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.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入口Json修补程序失败_Kubernetes_Yaml_Kustomize - Fatal编程技术网

Kubernetes入口Json修补程序失败

Kubernetes入口Json修补程序失败,kubernetes,yaml,kustomize,Kubernetes,Yaml,Kustomize,我试图用Kustomize修补一个入口,但失败了 入口补丁: - op: replace path: /spec/rules/http/paths/path/backend/serviceName value: varnish - op: replace path: /spec/rules/http/paths/path/backend/servicePort value: 6091 下面是我的入口 apiVersion: extensions/v1beta1 kind: In

我试图用Kustomize修补一个入口,但失败了

入口补丁:

- op: replace
  path: /spec/rules/http/paths/path/backend/serviceName
  value: varnish
- op: replace
  path: /spec/rules/http/paths/path/backend/servicePort
  value: 6091
下面是我的入口

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: magento-web
  namespace: magento
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:eu-west-2:AccountID:certificate/aaccxsdssa-bbb-434f-b2f9dss-05xxxx51f30
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
    alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": {"Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
    alb.ingress.kubernetes.io/scheme: internet-facing
  labels:
    app: magento-web
spec:
  rules:
    - host: training-example.cloud
    - http:
        paths:
          - path: /*
            backend:
              serviceName: magento-web
              servicePort: 80
我试图从规范中筛选项目,但我的补丁仍然失败。我想在这里应该做些什么/spec/rules/http/path/path/backend/serviceName

kustomize.yaml

bases:
  - ../step-3
  - ../bases/varnish

patchesJson6902:
- path: patch/ingress.yaml
  target:
    group: networking.k8s.io
    version: v1beta1
    kind: Ingress
    name: main
    namespace: magento

configMapGenerator:
- name: aux
  namespace: magento
  behavior: merge
  env: config/aux.env

规则和路径是JSON数组。所以你需要这个号码。我可以向您推荐一个类似这样的网站,您可以在其中粘贴json并深入到您的字段

这应该起作用:

- op: replace
  path: /spec/rules/1/http/paths/0/backend/serviceName
  value: varnish
- op: replace
  path: /spec/rules/1/http/paths/0/backend/servicePort
  value: 6091

你能添加你的kustomization.yaml吗?请检查kustomization.yamlerror:找不到目标网络。k8s.io|u v1beta1|u ingres | magento | ~P | magento web | ~S用于json补丁你必须调整你的kustomization.yaml以匹配ingres.yaml的确切
组:扩展版本:v1beta1
非常感谢!它解决了这个问题