It has allowed organizations to manage their container applications with ease by providing several resources to manage container deployments, replicas, scaling, service discovery, and networking through a single API Interface.
There are various ways to manage your Kubernetes resources for multiple environments, such as Helm and Kustomize.
For Kustomize to work in that scenario, you would need a base directory that would contain all manifest files with all the common elements and an overlay directory that contains all the differences for a particular environment.
In the base directory, the deployment.yaml file looks like the following: The service.yaml file looks like the below: Now, for Kustomize to work, we need to create a kustomization.yaml file that will look like the following: As we can see, the Kustomization file contains the apiVersion and kind attributes like any other Kubernetes resource.
Within the test directory, we have the following namespace.yaml file: Along with that, we have the following deployment.yaml file: The reason for having a deployment.yaml file here was because we wanted to change the number of replicas in the test environment from 1 to Now, let’s look at the kustomization.yaml file : Most of the sections are similar to the dev kustomization.yaml file.