This repository contains a simple kubernetes project with multiple pods and a load balancer based on NGINX.
Deployments are the basic unit of kubernetes, within them you can find how each component is defined and configured. In this example there are three deployments as follow:
Services define the way each pod is exposed, either to other services within the cluster or to an external network. These are as follow:
There are times when a service needs to ofuscate information that could be sensitive. Kubernetes offers a secret object that allows for this information to be stored without being shared. Normally this information would be excluded from the version control.
As the name implies, this components give a better control when configuring services, allowing for more readable and better configured environments. in this example, the database and load balancer were configured to allow a correct function of the application.
In this example Minikube
was used to provide a local cluster in which to deploy the application, to install it just follow the instructions.
Once installed and started, it is possible to begin with the deployment. It is important to take into account the existing dependencies between components in order to avoid errors. In this case, the order to follow is the following:
- Secrets & Configurations
- Database deployment & service
- Main deployment & service
- Load balancer deployment
- Load balancer service
Finally, to access the service you can use the command minikube service nginx-service
Alejandro Espinosa