DEV Community

Cover image for Let's Learn Kubernetes - Basics - 4
Prashant Ghildiyal
Prashant Ghildiyal

Posted on

Let's Learn Kubernetes - Basics - 4

Kubernetes is a container management tool that automates the deployment, scaling, and operations of an application.

In the previous blog of 'Let's learn Kubernetes' Series, we have learnt all about Storage. We learnt about concepts like Persistent Volume & Persistent Volume Claims, Storage Classes & Dynamic provisioning of Storage Classes.

Continuing with the series, this blog consists about few additional configurations that are useful/necessary. In this blog we'll give a short explanation of each concept and then post a link that explains the same in-depth.

Before diving in, it would be great if you can check out, star ⭐ our Repo - Devtron, An End-to-End Kubernetes Software Delivery Workflow, which makes the DevOps workflow flawless for Developers, DevOps Engineers.

GitHub logo devtron-labs / devtron

Software Delivery Workflow For Kubernetes

Configurations

In the final blog of the Let's learn Kubernetes series, here are some of the few additional configurations that are usually used by the folks working on Kubernetes in their day-to-day routine.
The blog covers following configurations:

  • ConfigMaps
  • Secrets
  • Resource management
  • KubeConfig Files
  • Best practices of using Kubernetes

ConfigMaps

ConfigMaps are more like an API object that is used to store some non-confidential data in the form of key-value pairs. They contain environment variables, command line arguments which are in turn used by pods for fetching data. They also allow you to keep your configurations separate from your pods and components which helps to keep your workloads portable. It keeps their configurations easy to change and manage.

ConfigMaps Illustration

To know more about ConfigMaps you can Check out the link below:

Secrets

Secrets store confidential information for your pods or clusters. This information can be passwords, AuthTokens , SSH keys etc.

Keeping confidential data in secrets is way more secure than defining them in Configmaps in the form plain text or in the pods specifications. It reduces the risk of exposing data to unauthorized users. Kubernetes Secrets are, by default, stored unencrypted in the API server's underlying data store (etcd).

Secrets Illustrtion

Want to know more about Secrets? Check out this article:

Resource management

As Kubernetes helps in automating the major portion of your deployments making it simple to manage the applications. Yet, these containerized applications commonly share pooled resources so the resource allocation and management should be done properly.

Here are 5 ways in which this works:

  • Use namespace and resource quotas
  • Use limit ranges
  • Set network policies
  • Don’t forget about storage when applicable
  • Keep things tidy API objects and monitoring

Resource Management in Kubernetes

This article goes in-depth regarding Resource Management:

Kubeconfig Files

A Kubeconfig file is a file used to configure access to Kubernetes when used in conjunction with the kubectl command-line tool (or other clients). The use of this file is to organize the information about clusters, users, and namespaces. This kubectl command-line program uses the Kubeconfig file to find the information within a particular cluster by communicating with the API server of that cluster.

By default, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other Kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.

Kubeconfig Illustration

The above image shows how the contexts define the information and configuration of the clusters listed in the Kubeconfig file.

To better understand the process, check out:

Best practices of using Kubernetes

Till now, we came up with a series of blogs addressing all the basic concepts of Kubernetes. Starting from pods, controllers to networking and storage. Now at the end of this series, it is very important to understand how to use these configurations in the best possible way to keep on enhancing the cluster’s efficiency.

Following are the few best practices to realize a Kubernetes cluster model that is scalable, secured and highly optimized:

  • Download the latest version
  • Use namespaces
  • Maintain small container images
  • Set resources , requests and limits
  • Use readinessProbe and livenessProbe
  • Deploy RBAC for security
  • Auto scale and many more.

To get a better understanding regarding these practices check out:

Finally, we come to an end of our series discussing various basic concepts that are essential to get a grip on Kubernetes. I am really glad to see a lot of positive response on the previous blogs in the series. It is always helpful, If you'd like to suggest what are the other topics you want me to write on.

Meanwhile, you can also check previous blogs in this series.

Discussion (1)

Collapse
welkson profile image
Welkson Renny de Medeiros

Excellent post! Thanks Prashant.