title: Kubernetes SSL Redirect Ingress
body: <p>I am very new to Kubernetes and I am trying to figure out how to set up a http -> https redirect for my kubernetes cluster. I have searched and have tried many different annotations and I am not sure if I am applying them correctly or not. I have pasted my files below and would be happy to share more if more is necessary. </p>
  
  <p>I have tried to adding these lines to the annotation section</p>
  
  <pre><code>nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
  nginx.ingress.kubernetes.io/ssl-redirect: "true"
  </code></pre>
  
  <p>I have also tried to implement this workaround, but have not had success.</p>
  
  <p><a href="https://github.com/kubernetes/ingress-nginx/issues/2724#issuecomment-444835897" rel="noreferrer">Redirect workaround</a></p>
  
  <p>I appreciate the help! </p>
  
  <p>service.yaml</p>
  
  <pre><code>kind: Service
  apiVersion: v1
  metadata:
    name: loadbalancer-ingress
    annotations:
      {{- if .Values.loadbalancer.cert }}
      service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ .Values.loadbalancer.cert | quote }}
      service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "{{- range .Values.loadbalancer.ports -}}{{- if .ssl -}}{{ .name }},{{- end -}}{{- end -}}"
      {{- end }}
      service.beta.kubernetes.io/aws-load-balancer-backend-protocol: {{ .Values.loadbalancer.backend_protocol | quote }}
      service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "60"
  spec:
    type: LoadBalancer
    selector: 
      pod: {{ .Chart.Name }}
    ports:
      {{- range .Values.loadbalancer.ports }}
      - name: {{ .name }}
        port: {{ .port }}
        targetPort: {{ .targetPort }}
      {{- end }}
  </code></pre>
  
  <p>configmap.yaml</p>
  
  <pre><code>---
  kind: ConfigMap
  apiVersion: v1
  metadata:
    name: {{ .Chart.Name }}-nginx-configuration
  data:
    use-proxy-protocol: "false"
    use-forwarded-headers: "true"
    server-tokens: "false"
  
  ---
  kind: ConfigMap
  apiVersion: v1
  metadata:
    name: {{ .Chart.Name }}-tcp-services
  
  ---
  kind: ConfigMap
  apiVersion: v1
  metadata:
    name: {{ .Chart.Name }}-udp-services
  </code></pre>
  
  <p>values.yaml</p>
  
  <pre><code>loadbalancer:
    backend_protocol: http
    cert: MY_AWS_CERT
    ports:
      - name: http
        port: 80
        targetPort: 80
        ssl: false
      - name: https
        port: 443
        targetPort: 80
        ssl: true
  </code></pre>