I am currently setting up an environment to deploy an application on google cloud platform using kubernetes.
I tried setting up an Ingress to connect to my
NodePort services with the following yaml config:
apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: my-ingress annotations: ingress.gcp.kubernetes.io/pre-shared-cert: "my-certificate" spec: rules: - host: example.com http: paths: - path: /* backend: serviceName: website servicePort: 80 - path: /api/* backend: serviceName: api servicePort: 80
example.com and all routes go to my
website service, and all requests to
example.com/api/ go to my API app.
Only thing is I want all requests to be rewritten to my app as
/<endpoint> instead of
/api/<endpoint>. Just a few days back gcp added the ability to specify additional redirect and rewrite rules for load balancers, but it isn't available to be configured in YAML yet (as seen here: https://github.com/kubernetes/ingress-gce/issues/109).
Now I went to go manually configure the host rewrite through the cloud console. Once I save, the settings appear to get reverted back within about 10 minutes and I can't figure out why.
I also want to set up a http to https redirect rule, but I can't create these either because they seem to get reverted as well.
Could anybody explain why this is?
I'm not sure if it matters but I used
kubectl apply -f my-ingress.yaml to create the ingress