title: Redirect from http port (80) to https port(443) on Kubernetes
body: <p>i'm new to this,</p>
  
  <p>How can I redirect from http port(80) to https port(443) on the same domain(service) in Kubernetes.</p>
  
  <p>I've tried putting nginx on same pod(container) and redirecting from http to https but it didn't work.</p>
  
  <p><strong>I tried this way on same pod</strong></p>
  
  <pre><code>  //nginx
      server {
          listen         80;
          server_name    example.com;
          return         301 https://$server_name$request_uri;
          }
  </code></pre>
  
  <p><strong>Kubernetes example deployment file.</strong></p>
  
  <pre><code>//Jupyterhub is running on port 8000.
      spec:
        ports:
        - port: 443
          name: https
          protocol: TCP
          targetPort: 8000
        - port: 80
          name: http
          protocol: TCP
          targetPort: 433
  </code></pre>
  
  <p>Is there a default way within kubernetes?</p>
  
  <p>Any help is much appreciated.</p>