force http to https on GKE ingress cloud loadbalancer

5/14/2020

How to force https traffic only in GKE when using ingress cloud loadbalancer, is there any special annotations or something similar to solve this

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: example-oms-ingress
  namespace: example-oms
  annotations:
    kubernetes.io/ingress.class: "gce"
    kubernetes.io/ingress.global-static-ip-name: "example-gke-oms"
spec:
  tls:
    - hosts:
        - oms-test-gke.example.com
      secretName: test-example-tls
  rules:
    - host: oms-test-gke.example.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: example-oms-svc
              servicePort: 80
    - host: oms-test-gke.example.com

nginx ingress controller is not in the picture

Update:

Was able to solve by creating a new loadbalancer with a rule mentioned in

https://cloud.google.com/load-balancing/docs/https/setting-up-traffic-management#creating_the_url_map_for_handling_http_traffic

make sure you delete the port 80 on front-end LB of ingress before you create the new frwd lb

-- Tibin
gcp-load-balancer
google-cloud-platform
google-kubernetes-engine
kubernetes
kubernetes-ingress

0 Answers