I have CFSSL service running in kubernetes on port 8888
. I can access it API's from another pod directly referring cfssl:8888
. I want to expose it via Nginx and I have Nginx running in separate pod with following config
upstream cfssl {
server cfssl:8888;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
location / {
proxy_pass http://cfssl;
proxy_set_header Host cfssl;
}
}
But this Nginx config is not working, I can access cfssl:8888
wethin Nginx pod, but when I do curl localhost:80
curl: (7) Failed to connect to localhost port 80: Connection refused
What is wrong in this setup ?
Inside location block you have not mention port
location / {
proxy_pass http://cfssl;
it should be something like
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
location / {
proxy_pass http://cfssl:8888;
proxy_set_header Host cfssl;
}