<p>I am making a kubernetes application deployment with gitlab kubernetes integration.
I ran into an issue that after putting the pods (containers) on ssl, the browser responds with:</p>
<pre><code>    Bad Request
    Your browser sent a request that this server could not understand.
    Reason: You're speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.
    Apache/2.4.38 (Debian) Server at docker.vm Port 80
</code></pre>
<p>I am accessing the browser url with https://***********.eu/ and have no idea why it is redirected from https to http inside the kubernetes on the way to the pods.</p>
<p>My Ingress.yaml</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    field.cattle.io/publicEndpoints: '[{&quot;addresses&quot;:[&quot;******&quot;],&quot;port&quot;:443,&quot;protocol&quot;:&quot;HTTPS&quot;,&quot;serviceName&quot;:&quot;******&quot;,&quot;ingressName&quot;:&quot;******&quot;,&quot;hostname&quot;:&quot;******&quot;,&quot;path&quot;:&quot;/&quot;,&quot;allNodes&quot;:true},{&quot;addresses&quot;:[&quot;******&quot;],&quot;port&quot;:443,&quot;protocol&quot;:&quot;HTTPS&quot;,&quot;serviceName&quot;:&quot;******&quot;,&quot;ingressName&quot;:&quot;******&quot;,&quot;hostname&quot;:&quot;******&quot;,&quot;path&quot;:&quot;/&quot;,&quot;allNodes&quot;:true}]'
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: &quot;true&quot;
  creationTimestamp: &quot;2021-05-21T12:54:44Z&quot;
  generation: 1
  labels:
    app: development
    chart: auto-deploy-app-1.0.7
    heritage: Tiller
    release: development
  managedFields:
  - apiVersion: extensions/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:kubernetes.io/ingress.class: {}
          f:kubernetes.io/tls-acme: {}
        f:labels:
          .: {}
          f:app: {}
          f:chart: {}
          f:heritage: {}
          f:release: {}
      f:spec:
        f:rules: {}
        f:tls: {}
    manager: Go-http-client
    operation: Update
    time: &quot;2021-05-21T12:54:44Z&quot;
  - apiVersion: networking.k8s.io/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:status:
        f:loadBalancer:
          f:ingress: {}
    manager: nginx-ingress-controller
    operation: Update
    time: &quot;2021-05-21T12:55:25Z&quot;
  - apiVersion: extensions/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:field.cattle.io/publicEndpoints: {}
    manager: rancher
    operation: Update
    time: &quot;2021-05-21T12:55:25Z&quot;
  name: development-auto-deploy
  namespace: ******
  resourceVersion: &quot;******&quot;
  selfLink: /apis/networking.k8s.io/v1/namespaces/******
  uid: ******
spec:
  rules:
  - host: ******
    http:
      paths:
      - backend:
          service:
            name: development-auto-deploy
            port:
              number: 443
        path: /
        pathType: ImplementationSpecific
  - host: ******
    http:
      paths:
      - backend:
          service:
            name: development-auto-deploy
            port:
              number: 443
        path: /
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - ******
    - ******
    secretName: development-auto-deploy-tls
&lt;/pre&gt;

My Service.yaml

&lt;pre&gt;
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: &quot;2021-05-21T12:54:44Z&quot;
  labels:
    app: development
    chart: auto-deploy-app-1.0.7
    heritage: Tiller
    release: development
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:app: {}
          f:chart: {}
          f:heritage: {}
          f:release: {}
      f:spec:
        f:ports:
          .: {}
          k:{&quot;port&quot;:443,&quot;protocol&quot;:&quot;TCP&quot;}:
            .: {}
            f:name: {}
            f:port: {}
            f:protocol: {}
            f:targetPort: {}
        f:selector:
          .: {}
          f:app: {}
          f:tier: {}
        f:sessionAffinity: {}
        f:type: {}
    manager: Go-http-client
    operation: Update
    time: &quot;2021-05-21T12:54:44Z&quot;
  name: development-auto-deploy
  namespace: ******
  resourceVersion: &quot;******&quot;
  selfLink: /api/v1/namespaces/******
  uid: ******
spec:
  clusterIP: ******
  ports:
  - name: web
    port: 443
    protocol: TCP
    targetPort: 443
  selector:
    app: development
    tier: web
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}
&gt;
</code></pre>
<p>And deployment.yaml for the pod deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    app.gitlab.com/app: *******
    app.gitlab.com/env: development
    deployment.kubernetes.io/revision: &quot;1&quot;
    field.cattle.io/publicEndpoints: '[{&quot;addresses&quot;:[&quot;*******&quot;],&quot;port&quot;:443,&quot;protocol&quot;:&quot;HTTPS&quot;,&quot;serviceName&quot;:&quot;*******&quot;,&quot;ingressName&quot;:&quot;*******&quot;,&quot;hostname&quot;:&quot;*******&quot;,&quot;path&quot;:&quot;/&quot;,&quot;allNodes&quot;:true},{&quot;addresses&quot;:[&quot;*******&quot;],&quot;port&quot;:443,&quot;protocol&quot;:&quot;HTTPS&quot;,&quot;serviceName&quot;:&quot;*******&quot;,&quot;ingressName&quot;:&quot;*******&quot;,&quot;hostname&quot;:&quot;*******&quot;,&quot;path&quot;:&quot;/&quot;,&quot;allNodes&quot;:true}]'
  creationTimestamp: &quot;2021-05-21T12:54:44Z&quot;
  generation: 2
  labels:
    app: development
    chart: auto-deploy-app-1.0.7
    heritage: Tiller
    release: development
    tier: web
    track: stable
  managedFields:
  - apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:app.gitlab.com/app: {}
          f:app.gitlab.com/env: {}
        f:labels:
          .: {}
          f:app: {}
          f:chart: {}
          f:heritage: {}
          f:release: {}
          f:tier: {}
          f:track: {}
      f:spec:
        f:progressDeadlineSeconds: {}
        f:replicas: {}
        f:revisionHistoryLimit: {}
        f:selector:
          f:matchLabels:
            .: {}
            f:app: {}
            f:release: {}
            f:tier: {}
            f:track: {}
        f:strategy:
          f:rollingUpdate:
            .: {}
            f:maxSurge: {}
            f:maxUnavailable: {}
          f:type: {}
        f:template:
          f:metadata:
            f:annotations:
              .: {}
              f:app.gitlab.com/app: {}
              f:app.gitlab.com/env: {}
              f:checksum/application-secrets: {}
            f:labels:
              .: {}
              f:app: {}
              f:release: {}
              f:tier: {}
              f:track: {}
          f:spec:
            f:containers:
              k:{&quot;name&quot;:&quot;auto-deploy-app&quot;}:
                .: {}
                f:env:
                  .: {}
                  k:{&quot;name&quot;:&quot;DATABASE_URL&quot;}:
                    .: {}
                    f:name: {}
                    f:value: {}
                  k:{&quot;name&quot;:&quot;GITLAB_ENVIRONMENT_NAME&quot;}:
                    .: {}
                    f:name: {}
                    f:value: {}
                  k:{&quot;name&quot;:&quot;GITLAB_ENVIRONMENT_URL&quot;}:
                    .: {}
                    f:name: {}
                    f:value: {}
                f:envFrom: {}
                f:image: {}
                f:imagePullPolicy: {}
                f:livenessProbe:
                  .: {}
                  f:failureThreshold: {}
                  f:httpGet:
                    .: {}
                    f:path: {}
                    f:port: {}
                    f:scheme: {}
                  f:initialDelaySeconds: {}
                  f:periodSeconds: {}
                  f:successThreshold: {}
                  f:timeoutSeconds: {}
                f:name: {}
                f:ports:
                  .: {}
                  k:{&quot;containerPort&quot;:443,&quot;protocol&quot;:&quot;TCP&quot;}:
                    .: {}
                    f:containerPort: {}
                    f:name: {}
                    f:protocol: {}
                f:readinessProbe:
                  .: {}
                  f:failureThreshold: {}
                  f:httpGet:
                    .: {}
                    f:path: {}
                    f:port: {}
                    f:scheme: {}
                  f:initialDelaySeconds: {}
                  f:periodSeconds: {}
                  f:successThreshold: {}
                  f:timeoutSeconds: {}
                f:resources: {}
                f:terminationMessagePath: {}
                f:terminationMessagePolicy: {}
            f:dnsPolicy: {}
            f:imagePullSecrets:
              .: {}
              k:{&quot;name&quot;:&quot;*******&quot;}:
                .: {}
                f:name: {}
            f:restartPolicy: {}
            f:schedulerName: {}
            f:securityContext: {}
            f:terminationGracePeriodSeconds: {}
    manager: Go-http-client
    operation: Update
    time: &quot;2021-05-21T12:54:44Z&quot;
  - apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:deployment.kubernetes.io/revision: {}
      f:status:
        f:availableReplicas: {}
        f:conditions:
          .: {}
          k:{&quot;type&quot;:&quot;Available&quot;}:
            .: {}
            f:lastTransitionTime: {}
            f:lastUpdateTime: {}
            f:message: {}
            f:reason: {}
            f:status: {}
            f:type: {}
          k:{&quot;type&quot;:&quot;Progressing&quot;}:
            .: {}
            f:lastTransitionTime: {}
            f:lastUpdateTime: {}
            f:message: {}
            f:reason: {}
            f:status: {}
            f:type: {}
        f:observedGeneration: {}
        f:readyReplicas: {}
        f:replicas: {}
        f:updatedReplicas: {}
    manager: kube-controller-manager
    operation: Update
    time: &quot;2021-05-21T12:54:55Z&quot;
  - apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:field.cattle.io/publicEndpoints: {}
    manager: rancher
    operation: Update
    time: &quot;2021-05-21T12:55:25Z&quot;
  name: development
  namespace: *******
  resourceVersion: &quot;*******&quot;
  selfLink: /apis/apps/v1/namespaces/*******
  uid: *******
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: development
      release: development
      tier: web
      track: stable
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        app.gitlab.com/app: *******
        app.gitlab.com/env: development
        checksum/application-secrets: *******
      creationTimestamp: null
      labels:
        app: development
        release: development
        tier: web
        track: stable
    spec:
      containers:
      - env:
        - name: DATABASE_URL
          value: ' '
        - name: GITLAB_ENVIRONMENT_NAME
          value: development
        - name: GITLAB_ENVIRONMENT_URL
          value: *******
        envFrom:
        - secretRef:
            name: development-secret
        image: *******
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /
            port: 443
            scheme: HTTPS
          initialDelaySeconds: 15
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 15
        name: auto-deploy-app
        ports:
        - containerPort: 443
          name: web
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /
            port: 443
            scheme: HTTPS
          initialDelaySeconds: 5
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 3
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: *******
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: &quot;2021-05-21T12:54:55Z&quot;
    lastUpdateTime: &quot;2021-05-21T12:54:55Z&quot;
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: &quot;True&quot;
    type: Available
  - lastTransitionTime: &quot;2021-05-21T12:54:44Z&quot;
    lastUpdateTime: &quot;2021-05-21T12:54:55Z&quot;
    message: ReplicaSet &quot;*******&quot; has successfully progressed.
    reason: NewReplicaSetAvailable
    status: &quot;True&quot;
    type: Progressing
  observedGeneration: 2
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1
</code></pre>
<p>SSL is removed somewhere and kubernetes ingress calls the pods with http:// instead of https://, but I do not know how to fix it.</p>
<p>So the question is: How to remove SSL termination from kubernetes ingress?</p>

ValdisAglonietis
<p>If you want SSL termination to happen at the server instead at the ingress/LoadBalancer, you can use a something called SSL Passthrough.
Load Balancer will then not terminate the SSL request at the ingress but then your server should be able to terminate those SSL request.
Use these configuration in your ingress.yaml file depending upon your ingress class</p>
<pre><code>   annotations:
    ingress.kubernetes.io/ssl-passthrough: &quot;true&quot;
    nginx.ingress.kubernetes.io/ssl-passthrough: &quot;true&quot;

</code></pre>
<p>There is one more annotation that you can use in nginx. <code>backend-protocol</code> annotations is possible to indicate how NGINX should communicate with the backend service.</p>
<pre><code>nginx.ingress.kubernetes.io/backend-protocol: &quot;HTTPS&quot;
</code></pre>
<p>By default NGINX uses <code>HTTP</code>.</p>
<p>Read more about it here <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol</a></p>
