title: Nginx on Kubernetes (99: Cannot assign requested address)
body: <p>So I have a service of my application and want nginx to proxy the connection to it. I used IP address to tell the nginx which is the Service Node port of the application (100.68.202.75). The issue is that when the pods starts it gives me:</p>
  
  <p>2019/05/25 17:32:38 [emerg] 1#1: bind() to 100.71.178.70:443 failed (99: Cannot assign requested address)
  nginx: [emerg] bind() to 100.71.178.70:443 failed (99: Cannot assign requested address)</p>
  
  <p>Application runs separately on a different deployment with a service. I just want to tell to listen for  that service. So it can redirect the traffic.</p>
  
  <pre><code>upstream so5098.exampler.com {
                  server  100.68.202.75:8080;
                 } 
     server {
          listen      80;
          server_name so5098.exampler.com masterqa-okta.exampler.com masterqapayrolltestingping.exampler.com;
          rewrite     ^(.*)   https://$host$1 permanent;
      }
          server {
  
          listen                  100.68.202.75:443;
          ssl                     on;
          ssl_certificate         /home/xenon/.ssl/exampler.com.crt;
          ssl_certificate_key     /home/xenon/.ssl/exampler.com.key;
          ssl_protocols TLSv1.1 TLSv1.2;
          ssl_ciphers 'TLS_RSA_WITH_AES_256_CBC_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:AES256-SHA256:AES128+EECDH:AES128+EDH:!aNULL';
          ssl_prefer_server_ciphers on;
          ssl_session_cache shared:SSL:10m;
          ssl_session_timeout 10m;
          server_name masterqa.exampler.com masterqa-okta.exampler.com masterqapayrolltestingping.exampler.com;
          # Upload file size limit
          client_max_body_size    50m;
          # bypass tomcat for profile images
          location ~* /masterqa/profile/[0-9]*/.*\.(jpg|jpeg|gif|png)$ {
              root /opt/documents/so5098/;
              rewrite /opt/documents/saintssecurity/docs/([0-9]*)/(.*) /$1/$2 break;
          }
      # bypass tomcat for company logos
          location ~* /so5098/logo/[0-9]*/.*\.(jpg|jpeg|gif|png)$ {
                  root /opt/example/docs-branch/;
                  rewrite /so5098/logo/([0-9]*)/(.*) /$1/$2 break;
          }
          # bypass tomcat for company theme
          location ~* /masterqa/companyTheme/theme/[0-9]+_.*\.css$ {
                  root /opt/documents/so5098;
                  rewrite /masterqa/companyTheme/theme/([0-9]*)_.*.css /$1/$1.css break;
          }
  
          location /so5098 {
              proxy_set_header X-Real-IP  $remote_addr;
              proxy_set_header Host $host;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
              proxy_pass http://100.68.202.75:8080/so5098;
              proxy_redirect http://$host https://$host;
          }
          location /so5098/api {
          proxy_set_header X-Real-IP  $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://127.0.0.1:8080/masterqa/api;
                  }
          location / {
          proxy_set_header X-Real-IP  $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          proxy_pass http://100.68.202.75:8080/so5098;
                  }
          }
  </code></pre>