Skip to main content
suryabhagvat

9 months ago

Nginx and kube-api server

I have been following the instructions so far and have come to the point where I have setup the worker nodes. I realized that on the first controller node kube-apiserver is not starting because the port 6443 is in use by Nginx


netstat -lutpn | grep 6443

tcp 0 0 0.0.0.0:6443 0.0.0.0:* LISTEN 1165/nginx -g daemo

On the second controller kube-apiserver starts without any issue and the port 6443 is used by kube-apiserver.


netstat -lutpn | grep 6443

tcp6 0 0 :::6443 :::* LISTEN 1153/kube-apiserver

Not sure where the mistake was made. I went back and checked the config files and everything seems to be in order. If I stop the nginx server on the first node then kube-api server starts but then when I try to start nginx it gives me an error.

Appreciate any help that I can get in this matter.

Thanks

Surya



Image of viccab
viccab
9 months ago
Try reviewing the nginx configuration of the first controller. By default,  nginx listens to port 80 only.  You can probably compare the config with that on the second controller. Run, systemctl status -l nginx to get the location of the config file.  Check also include folders mentioned in the file.  
Image of suryabhagvat
suryabhagvat
9 months ago
Thanks Victor. 

Figured out the issue, looks like the commands that we need to run on server 6 for  setting up kubeapi front load balancer, I ended up running on controller 1. So the nginx.conf file had the line below on server 1 which caused it to bind to port 6443.

include /etc/nginx/tcpconf.d/*;

Once I had commented it, ran the kubeapi front load balancer commands on server 6 and restarted nginx, things started to work. Also this resolved one more issue I had  of worker nodes not showing up when I give the command kubectl get nodes to get the worker nodes.

Thanks

Surya


Image of wboyd
wboyd
9 months ago
Glad to hear it's working!
Image of suryabhagvat
suryabhagvat
9 months ago
Thanks Will, the course is excellent :)