Pointing to a file in GCP located in Google Storage Buckets

Viewed 63

I have a link to a public URL in the format of https://storage.googleapis.com/companyname/foldername/.another-folder/file.txt

I want to create an ingress rule to create a path to this public file, so that whoever open a specific URL, e.g., https://myapp.mydomain.com/.another-folder/myfile.txt -> it open up above file.

I tried a few different ingress rules such as:

apiVersion: v1
kind: Service
metadata:
  name: googlestoragebucket
spec:
  externalName: storage.googleapis.com
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: 443
  type: ExternalName
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: staging-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: staging-static-ip
    kubernetes.io/ingress.class: gce
spec:
  defaultBackend:
    service:
      name: website-frontend
      port:
        number: 80
  rules:
  - host: myapp.mydomain.com
    http:
      paths:
      - path: /.another-folder/
        pathType: Prefix
        backend:
          service:
            name: googlestoragebucket
            port:
              number: 443
       - pathType: ImplementationSpecific
         backend:
          service:
            name: myactual-app
            port:
              number: 80

But I couldn't make it wrok. In this case I've got an error: Translation failed: invalid ingress spec: service "staging/googlestoragebucket" is type "ExternalName", expected "NodePort" or "LoadBalancer

I don’t mind any other solutions to achieve the same result in the context of GCP and Kubernetes.

Do you have any ideas?

Looking forward for you suggestions.

1 Answers
Related