What keywords did you search in NGINX Ingress controller issues before filing this one?: I have been searching the web for this issue the last 2 days, can't remember them all..
Is this a BUG REPORT or FEATURE REQUEST?: Bug most likely
NGINX Ingress controller version: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.14
Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-08-31T19:32:26Z", GoVersion:"go1.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.1-gke.0", GitCommit:"a8e22959b5a4c0ca54ef8860231074428c962466", GitTreeState:"clean", BuildDate:"2017-10-12T19:32:15Z", GoVersion:"go1.8.3b4", Compiler:"gc", Platform:"linux/amd64"}
Environment:
uname -a): UnsureWhat happened:
I am unable to establish a connection from my NGINX controller to my php website image.
The logs for my website image says:
[28-Oct-2017 17:03:14] NOTICE: fpm is running, pid 1
[28-Oct-2017 17:03:14] NOTICE: ready to handle connections
What you expected to happen:
I would expect a connection to occur and then a serving of my web content. After carefully examining the nginx.conf file it seems that it is not configured for PHP-FPM connections. It receives and uses the endpoint from the service (as i understands it should), basically everything looks good, but no website is served.
Looking at my own configured nginx file it seems that this (or similar configuration) is missing from the generated one.
# PHP
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
How to reproduce it (as minimally and precisely as possible):
Below is all deployment files I use, as well as the nginx.conf file generated.
nginx-ingress-help.zip
Anything else we need to know:
The image used for my page is build with this Dockerfile
FROM php:7.0-fpm:latest
RUN apt-get update && apt-get install -y zlib1g-dev libicu-dev libpq-dev \
&& docker-php-ext-install opcache \
&& docker-php-ext-install intl
RUN docker-php-ext-install pdo_mysql
RUN touch /var/log/php-error.log && chmod 777 /var/log/php-error.log
COPY ./staging/dist /var/www/html/
logs from the nginx controller gives me these messages:
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:05 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 481 0.001 [default-dev-portal-80] 10.16.0.6:80 0 0.001 502
2017/10/29 09:35:05 [error] 25#25: *169 connect() failed (111: Connection refused) while connecting to upstream, client: 10.16.0.1, server: example.com, request: "GET / HTTP/1.1", upstream: "http://10.16.0.6:80/", host: "example.com"
2017/10/29 09:35:06 [error] 25#25: *169 connect() failed (111: Connection refused) while connecting to upstream, client: 10.16.0.1, server: example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.16.0.6:80/favicon.ico", host: "example.com", referrer: "http://example.com/"
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:06 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 475 0.001 [default-dev-portal-80] 10.16.0.6:80 0 0.001 502
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:06 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 481 0.001 [default-dev-portal-80] 10.16.0.6:80 0 0.001 502
2017/10/29 09:35:06 [error] 25#25: *169 connect() failed (111: Connection refused) while connecting to upstream, client: 10.16.0.1, server: example.com, request: "GET / HTTP/1.1", upstream: "http://10.16.0.6:80/", host: "example.com"
2017/10/29 09:35:06 [error] 25#25: *169 connect() failed (111: Connection refused) while connecting to upstream, client: 10.16.0.1, server: example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.16.0.6:80/favicon.ico", host: "example.com", referrer: "http://example.com/"
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:06 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 475 0.000 [default-dev-portal-80] 10.16.0.6:80 0 0.000 502
2017/10/29 09:35:06 [error] 25#25: *169 connect() failed (111: Connection refused) while connecting to upstream, client: 10.16.0.1, server: example.com, request: "GET / HTTP/1.1", upstream: "http://10.16.0.6:80/", host: "example.com"
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:06 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 481 0.000 [default-dev-portal-80] 10.16.0.6:80 0 0.000 502
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:06 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 475 0.000 [default-dev-portal-80] 10.16.0.6:80 0 0.000 502
2017/10/29 09:35:06 [error] 25#25: *169 connect() failed (111: Connection refused) while connecting to upstream, client: 10.16.0.1, server: example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.16.0.6:80/favicon.ico", host: "example.com", referrer: "http://example.com/"
I would expect a connection to occur and then a serving of my web content. After carefully examining the nginx.conf file it seems that it is not configured for PHP-FPM connections.
That's right. The nginx ingress controller only uses http pr https connections to the upstream servers.
10.16.0.1 - [10.16.0.1] - - [29/Oct/2017:09:35:06 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36" 475 0.000 [default-dev-portal-80] 10.16.0.6:80 0 0.000 502
From the logs your upstream server is returning the http status code 502. Please make sure the service is working correctly.
@johan-lejdung please reopen if you have more questions
@aledbf By correctly, what do you mean? Is the nginx-ingress-controller not capable of serving the PHP-FPM content? Or would it work if I configured my service with yet another layer of nginx so that the content can be served?
I am having a hard time wrapping my head around this issue, any help would be greatly appreciated. Doesn't seem to find anything online either, except where people are not using the ingress controller.
Or would it work if I configured my service with yet another layer of nginx so that the content can be served?
This.
Ingress controller only provide access to http and https service. This means you need to configure the service with another nginx so the content can be served
Thank you! Appreciate your time and effort.
@aledbf Any future plans to add the ability to serve php-fpm contents directly with the upstream? Or is that out of scope for this project?
Most helpful comment
@aledbf Any future plans to add the ability to serve php-fpm contents directly with the upstream? Or is that out of scope for this project?