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.