GCE Ingress error 400 ensureRedirectUrlMap() redirect To Https

Viewed 292

I'm using GCE ingress, and I need to redirect all HTTP traffic to HTPPS, I added a custom frontend configuration like the following:

apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
metadata:
  name: frontendconfig
spec:
  redirectToHttps:
    enabled: true
    responseCodeName: MOVED_PERMANENTLY_DEFAULT

I used this configuration in the ingress:

apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
metadata:
  name: "api-ingress"
  namespace: "default"
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "STATIC_IP_NAME"
    networking.gke.io/managed-certificates: "CERTIFICATE_MANAGER_NAME"
    networking.gke.io/v1beta1.FrontendConfig: "frontendconfig"
spec:
  rules:
    - host: PROJECT_URL
      http:
        paths:
          - path: /*
            backend:
              serviceName: "api"
              servicePort: 3000

But I see in the ingress logs errors:

Error syncing to GCP: error running load balancer syncing routine: loadbalancer lo6kz19c-default-api-ingress-arsturnd does not exist: ensureRedirectUrlMap() = googleapi: Error 400: The url_map resource 'projects/******/global/urlMaps/k8s2-rm-lo6kz19c-default-api-ingress-arsturnd' is already being used by 'projects/******/global/targetHttpProxies/k8s2-tp-lo6kz19c-default-api-ingress-arsturnd', resourceInUseByAnotherResource

Updated: Solved I found the issue, it was a duplicate entry from ingress in another file.

1 Answers

The issue has been resolved, the error was in the code(duplicate code), I was using another ingress in the same deployment but in another file with the same name of the existing ingress.

Related