Deploying Kubernetes in a production environment
In this section, we'll be covering some of the important points and concepts that can be used to deploy Kubernetes in production.
Exposing Kubernetes services: Once we deploy the Kubernetes pods, we expose them using services. The Kubernetes service is an abstraction, which defines a set of pods and a policy to expose them as a microservice. The service gets its own IP address, but the catch is that this address only exists within the Kubernetes cluster, which means the service is not exposed to the Internet. It's possible to expose the service directly on the host machine port, but once we expose the service on the host machine, we get into port conflicts. It also voids Kubernetes benefits and makes it harder to scale the deployed service:
Kubernetes service exposed through external load balancer
One solution is to add an external load balancer such as HAProxy or NGINX. This is configured with a backend for each Kubernetes service and proxies...