I'm researching how to deploy a game server with kubernetes, but am running into an issue with having the pods running the game be accessible to the web without a LoadBalancer. Since running a load balancer for each pod is not an option I was told to use ingress with nodeports to make them available over the web.
I am able to get the cluster created and the pods all distributed onto the nodes the way I want them, I am unable to make them accessible though. I created a github repo, link is to the kubernetes section, that has all the code to run the server locally if you want to test it. As for running the project in the cloud though I can't seem to get that to work. In the Readme I have the steps I went through and the files with the code I have so far. Does anyone know where I am going wrong?
Am I missing a file or some conceptual idea that is going over my head with the nodeports setup?
Your README.md shows the command used to create your node pool as:
az aks nodepool add --resource-group mwK8ResourceGroup --cluster-name cluster-1 --name gamenodepool --node-count 2 --kubernetes-version 1.15.7 --labels "workload=game-selector" --node-taints "key1=value1:NoExecute" --node-osdisk-size 30 --node-vm-size Standard_DS2_v2 --debug
When setting up a NodePort type of service, the service is exposed by accessing the node directly via a IP address. I would expect that your create command would include --enable-node-public-ip
for your sample code to work as-is.
Please refer to this section of the kubernetes docs for details: https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#exposing-the-service
You can also run a separate load balancer that forwards traffic to each/either node on the port that is exposed by the NodePort service(s).
If you exposed the service using an "Ingress" resource, you would access the service via the cluster IP address rather than the individual node's IP address.
I found that I needed to use ClusterIP instead of NodePort. I also found that I needed to patch not just the ingress deployment but I also needed to patch the ingress service to include the tcp-services data ports I was saying were available in the Ingress deployment.