Nginx on Kubernetes (99: Cannot assign requested address)

Danny

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:

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)

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.

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;
                }
        }
Vasili Angapov

You should replace listen 100.68.202.75:443; with listen 443 ssl;. Pod IP is dynamic and changes every time it gets restarted.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Bind error (99): Cannot assign requested address

OSError: [Errno 99] Cannot assign requested address

Errno 99 - Cannot assign requested address

CentOS8 nginx: [emerg] bind() failed (99: Cannot assign requested address)

Mesos bind error : Cannot assign requested address [99]

PHP - memcache randomly fails with - Cannot assign requested address (99)

Raspberry Pi TCP socket - [Errno 99] Cannot assign requested address

Cannot connect to redis://localhost:6379/0: Error 99 connecting to localhost:6379. Cannot assign requested address

Flask, cannot assign requested address

Docker Cannot assign requested address

Docker + django_extensions + jupyter: OSError: [Errno 99] Cannot assign requested address

RedisInsight on Docker and Redis on Docker: Could not connect: Error 99 connecting to localhost:6379. Cannot assign requested address

socket.error:[errno 99] cannot assign requested address and namespace in python

socket.error:[errno 99] cannot assign requested address : flask and python

redis.exceptions.ConnectionError: Error 99 connecting to localhost:6379. Cannot assign requested address

Cannot assign requested address (when using Docker)

How to fix 'Cannot assign requested address?'

gin-gonic cannot assign requested address

Netty SocketIO - Cannot assign requested address in AWS

requests, cannot assign requested address, out of ports?

Docker for Windows: cannot assign requested address

Set MAC address fails - RTNETLINK answers: Cannot assign requested address

bind: cannot assign requested address on UDPclient in local network

Server binding results in error "Cannot assign requested address"?

"Cannot assign requested address" when trying to set TUN interface netmask

Cannot Assign requested Address in AWS - JAVA Server Socket

MongoDB Replica Set setup is giving - SocketException: Cannot assign requested address

unable to bind socket: Cannot assign requested address issue on ubuntu

redigo: getting dial tcp: connect: cannot assign requested address