What are the core concepts in Kubernetes?

|
Last Updated:
|
|

What are the core concepts in Kubernetes? Kubernetes, aka K8s, is the current de facto container orchestration platform providing a robust set of tools for automating deployment, scaling, and management of containerized applications. If you are getting started with Kubernetes, it is important to understand its core concepts and building blocks that enables you to create, deploy, and manage your containerized applications.

What are the core concepts in Kubernetes?

To unlock the full potential of Kubernetes, let’s explore some of its core concepts.

Node

In a Kubernetes cluster, a node is a virtual or a physical machine on which Kubernetes application run. A Node can be a Master Node, which controls the Kubernetes cluster or a Worker Node, which hosts containerized application.

What are the core concepts in Kubernetes?

Pod

A Pod is the smallest deployable unit in Kubernetes and represents a group of one or more containers. Pods share same storage, same network resources (IP addresses and ports) and information on how to run each containers. Worker nodes host Pods. Each Pod runs on a specific node until they are terminated or deleted.

What are the core concepts in Kubernetes?

ReplicaSet (RS)

This is a Kubernetes object which is responsible for ensuring that a specific number of Pod replicas are running at any given time in the Kubernetes cluster. They can be used to scale the cluster down or scale it up. ReplicaSet has a Pod template that defines how a new Pod should be created when one fails. Similarly, it has a replica count which defines how many Pods should run concurrently in a node.

Deployments

A Deployment is a Kubernetes object that manages ReplicaSets and provides declarative updates to Pods in a cluster. Using Deployments to manage RS is the recommended way rather than using RS directly. Deployments can be used to rollout ReplicaSets, define the state of the Pods, rollback to earlier deployment state if need be, efficiently scale the number of replica Pods, pause rollout of a deployment, cleanup ReplicaSets that are not needed.

What are the core concepts in Kubernetes?

StatefulSet

StatefulSet is a Kubernetes API object that manages the deployment and scaling of stateful applications. It guarantees the order and uniqueness of the Pods. Stateful applications are applications that maintain their own internal state such as unique network identifiers, persistent data, e.t.c. Examples include databases.

DaemonSet

A DaemonSet is a Kubernetes object which ensures that a Pod is running on all or some nodes in the cluster. Typical use cases of DaemonSet include running cluster wide storage daemons, monitoring and log collection daemons.

Job

A Job is used to manage the execution of a batch jobs in Kubernetes cluster. Jobs can be used to run one-off tasks or periodic jobs, such as backups or database migrations.

CronJob

CronJob is used to perform regular scheduled tasks such as backups, report generation, e.t.c.

Kubernetes Service

Kubernetes Service is a Kubernetes object that exposes Pods over a network so that they can be accessible in the cluster. They can assign Pods unique IP address and a DNS name. Some of the Kubernetes publishing services include;

  • ClusterIP: Exposes a service on an internal IP that is ONLY accessible within the cluster.
  • NodePort: Exposes a service via a specific port bind to a node IP thus allows the service to be accessed from outside the cluster by using any node’s IP address and the NodePort value.
  • LoadBalancer: Exposes the service externally using a cloud provider’s load balancer.
  • ExternalName: used when you need to access individual pods directly without using a load-balanced service. It allows you to create a DNS record for the pods, which can be used to connect to them directly.

Ingress

Ingress is a Kubernetes API object that manages external access to the services in a cluster via HTTP/HTTPS. An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. Ingress achieves all these through the use of ingress controllers.

Volume

A Volume is a directory that can be used to store data that is accessible to the containers. Containers in a Pod share the same data volume. It is also possible to use volumes to share data between multiple Pods. There exists ephemeral volume types which have a lifetime of a pod and persistent volumes which stores the data beyond the lifetime of a pod.

Namespace

In Kubernetes, namespaces provides a way to logically divide and organize Kubernetes cluster into virtual sub-clusters. The use of namespaces comes in handy when a cluster is used by many users spread across multiple teams, or projects. By default, Kubernetes ships with four default namespaces namely;

  • default
  • kube-system
  • kube-public
  • kube-node-lease
  • kubernetes-dashboard (ONLY ships with minikube)

You can get a list of Kubernetes namespaces using the command kubectl get namespace.

For production environments, it is recommended to create your own custom namespaces rather than using the default namespaces. When you create a namespace, do not prefix it with kube– as this is reserved for use with default system Kubernetes namespaces.

ConfigMap

This is an API object in Kubernetes that stores non sensitive configuration data in key-value pairs outside the container images thus making an application portable. Configurations stored on a ConfigMap are the kind that changes frequently depending on the environment. They can be made available to the Pods via environment variables, supplied in a command line or even stored in volumes as configuration files.

Secret

Secret is Kubernetes object that is used to store sensitive information such as passwords, keys or tokens that can be consumed by a Kubernetes Pod. The difference between Secret and ConfigMap is that the former is used to store confidential data. Secret while being stored on etcd are unencrypted and thus anyone with access to etcd data store can access them.

Conclusion

While the above explains the most common Kubernetes concepts, there exists huge number of other Kubernetes concepts. Read more on Kubernetes concepts page.

That brings us to the end of our tutorial on What are the core concepts in Kubernetes.

Other Tutorials

Kubernetes Architecture: A High-level Overview of Kubernetes Cluster Components

Monitor Docker Swarm and Container metrics using Metricbeat

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment