Need of Package Manager


Need of Package Manager

In this tutorial, we are going to discuss about the purpose and need of a package manager within Kubernetes environment.

Need of Package Manager

Within Kubernetes cluster, we will be deploying n number of entities like Pods, services, deployments, secrets, config files and lot more, and all the definition of these entities will be available as a YAML file.

So I will be having a collection of YAML files and the entire collection will be deployed. And it demands the deployments to happen in some sequence.

So what we will be doing, we will consolidate all the YAML files in a single YAML file and the YAML file will be maintained within some repository. And from the repository using some CI/CD tools, we will be deploying it into the Kubernetes cluster.

So things will be done there. But the problem originates whenever I wanted to make some changes or update to the application. When I’m making the change or update to the application, I will be making change to some values.

Simple example

For example, let us consider this particular YAML file, which will be deploying redis service.

apiVersion: v1
kind: Service
metadata:
  labels:
    app: redis
  name: redis
  namespace: vote
spec:
  type: ClusterIP
  ports:
    - name: redis-service
      port: 6379
      targetPort: 6379
  selector:
    app: redis

Here I have mentioned the port and the target port for this particular service, it’s mentioned and it is hard coded within the YAML file.

And in case, if this particular value changes depending on the environment, say for example, I may have test environment where I wanted the port value to be 1234 and number of pod count to be two.

So within the YAML file, we will be having this particular hard coded value and in production, I may have the port value as say 8080 and the pod count say 6.

So what I’ll end up doing, I’ll end up maintaining 2 YAML files. One YAML file for test environment and another YAML file for production environment.

Other than these values, the template i.e., the other configuration details will be the same. So what I’m maintaining? I’m maintaining some duplicate values.

Templatising and the package manager

To solve the above problem templatising and the package manager comes into the picture. So what I will be doing, I will extract the common elements as a template.

So I’ll have the variable to be referred over here and only this particular variable needs to be substituted. I will be maintaining some value file over here for each environment.

So value for test. And that can be maintained as a JSON file or different file formats. Here I am demonstrating for understanding purpose. Don’t worry about the syntax or the format of the files.

And the same way I will be having another value file for the production environment as well. While doing the deployment, all I need to do is I need to use the template file, which is going to be the same for both environments. Only, the value file will be fed into the system depending on the type of deployment that I wanted to do.

And CI/CD can take care of picking the right files when it is getting deployed into the corresponding environment. This is where the biggest advantage of templating, repeatability, all that comes into the picture.

Another biggest advantage is, In case if I am making any change to this particular system or any of this particular value, say, for example, if I am changing a port of a specific service from 8080 to 8088 what will happen?

It will identify the need as well as the hierarchy and the dependent services that need to get deployed and only those entities will be deployed or it will get upgraded.

So we can go ahead and do different type of deployments like blue green, or rolling and all other possible deployments within the cluster.

Conclusion

This entire representation of templates and values, the package manager that is helm provide some standards and structure, how the templates should be created and how the values can be represented, how the sub templates as well as the complex representation of various entities of Kubernetes cluster is defined within the helm.

That’s what we are going to learn in detail of each and every syntax within the template, the value files and how to package the entire structure.

That is, the template files, value files, all of them together and send it across or share it with other team members in case if I want to version it as a repository and share it with other team over the Internet or share it with other CI/CD tools, we can go ahead and do that.

So this is a quick overview on the need and purpose of package manager within the Kubernetes environment.

Need of Package Manager


Scroll to top