Home > other >  validation error for multiingress yaml file for GKE
validation error for multiingress yaml file for GKE

Time:07-10

apiVersion: networking.gke.io/v1
kind: MultiClusterIngress
metadata:
  name: terraback-ingress
  namespace: terraback
  labels:
    version: v1
spec:
  template:
    spec:
      backend:
        serviceName: terraback-mcs-api
        servicePort: 8080
      rules:
      - host: socket.yoyo.com #<==== adjust this as needed
        backend:
          serviceName: terraback-mcs-socket
          servicePort: 8081 # <=== This gets routed to servicePort 8081 => 5050

I am getting the following error when running the command, what could be the issue? Also where can we get the detailed specification for the yaml file?

(base) PS D:\terraform_small\terra-back> kubectl apply -f mci.yaml
error: error validating "mci.yaml": error validating data: ValidationError(MultiClusterIngress.spec.template.spec.rules[0]): unknown field "backend" in io.gke.networking.v1.MultiClusterIngress.spec.template.spec.rules; if you choose to ignore these errors, turn validation off with --validate=false

The syntax is according to enter image description here

CodePudding user response:

This might be a bug. Can you try setting --validate=false to see if the resource gets created and functions as required?

CodePudding user response:

I have modified it to the following and it works

apiVersion: networking.gke.io/v1
kind: MultiClusterIngress
metadata:
  name: terraback-ingress
  namespace: terraback
  labels:
    version: v1
spec:
  template:
    spec:
      backend:
        serviceName: terraback-mcs
        servicePort: 8080
      rules:
      - host: socket.yoyo.com #<==== adjust this as needed
        http:
          paths:
            - backend:
                serviceName: terraback-mcs
                servicePort: 8081 # <=== This gets routed to servicePort 8081 => 5050

The syntax can be found in https://cloud.google.com/kubernetes-engine/docs/how-to/multi-cluster-ingress#multiclusteringress_spec

  • Related