0

Is it possible to setup cloud CDN storageBucket as ingress backend in 1.21.5-gke.1302? I was trying :

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: test-namespace
  annotations:
    kubernetes.io/ingress.global-static-ip-name: >
      test-gke-ingress,
      test-backendconfig
    kubernetes.io/ingress.allow-http: "false"
    networking.gke.io/managed-certificates: "test-ssl,"
spec:
  rules:
- host: test.example.com
  http:
    paths:
    - path: /*
      backend:
        serviceName: test-cdn-service
        servicePort: 80
    - path: /test
      backend:
        resource:
              kind: StorageBucket
              name: test-bucket

But getting:

[ValidationError(Ingress.spec.rules[7].http.paths[1].backend): unknown field "kind" in io.k8s.api.networking.v1beta1.IngressBackend, ValidationError(Ingress.spec.rules[7].http.paths[1].backend): unknown field "name" in io.k8s.api.networking.v1beta1.IngressBackend]

Is there a way to use Cloud CDN(backend bucket) with "GKE ingress"?

Denis
  • 81
  • 2
  • 7

1 Answers1

2

According to documentation:

if you are using GKE version 1.16-gke. 3 or later, you should use the cloud.google.com/backend-config annotation, even though the beta.cloud.google.com/backend-config annotation will also work.

For GKE versions 1.16.8-gke.3 and higher, it's recommend you use the cloud.google.com/v1 API version. If you are using an earlier GKE version, use cloud.google.com/v1beta1.

I think that this PR contains the change you're looking for.

`Ingress` and `IngressClass` resources have graduated to `networking.k8s.io/v1`. Ingress and IngressClass types in the `extensions/v1beta1` and `networking.k8s.io/v1beta1` API versions are deprecated and will no longer be served in 1.22+. Persisted objects can be accessed via the `networking.k8s.io/v1` API. Notable changes in v1 Ingress objects (v1beta1 field names are unchanged):
* `spec.backend` -> `spec.defaultBackend`
* `serviceName` -> `service.name`
* `servicePort` -> `service.port.name` (for string values)
* `servicePort` -> `service.port.number` (for numeric values)
* `pathType` no longer has a default value in v1; "Exact", "Prefix", or "ImplementationSpecific" must be specified
Other Ingress API updates:
* backends can now be resource or service backends
* `path` is no longer required to be a valid regular expression

Refer to the GitHub issue and Stackexchange post for more detailed information.

Fariya Rahmat
  • 2,123
  • 3
  • 11
  • Hi Fariya, Thank you vary much for reply. How can I specify storage bucket in backend config? – Denis Feb 18 '22 at 08:47
  • Refer to the link on [Setting up Cloud CDN with a backend bucket](https://cloud.google.com/cdn/docs/setting-up-cdn-with-bucket).Let me know if this helps – Fariya Rahmat Feb 18 '22 at 09:03
  • I saw this doc, but it doesn't describe anything related with backendconfig. Only how to setup CDN with backend bucket. – Denis Feb 18 '22 at 10:32
  • Specifying "backend buckets" is not supported on GCE Ingress yaml spec currently. If you modify a load balancer created by the Ingress controller to route some of the traffic to a backend bucket (by editing its URL map), your changes will be periodically overwritten by the Ingress controller. Your only option is likely to create a separate load balancer for your "backend bucket". Refer to the [link](https://github.com/kubernetes/ingress-gce/issues/33) for more details – Fariya Rahmat Feb 18 '22 at 13:13
  • Thank you for reply! I will try that! – Denis Feb 18 '22 at 13:22