Dive into Kubernetes

Ankit Garg
Geek Culture
Published in
6 min readMar 2, 2023
Learning Kubernetes

Kubernetes is a powerful container orchestration system that is designed to automate the deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF). In this blog, we’ll take a closer look at Kubernetes and explore its features and benefits.

What is Kubernetes?

Kubernetes is an open-source container orchestration system that automates the deployment, scaling, and management of containerized applications. It was designed to address the challenges of deploying and managing large-scale containerized applications. Kubernetes provides a platform for container deployment, scaling, and management, as well as a set of tools and APIs for automating container operations.

Key features of Kubernetes

Kubernetes provides a range of features that make it a powerful platform for deploying and managing containerized applications. Here are some of the key features of Kubernetes:

Automated container deployment and scaling

Kubernetes automates the deployment and scaling of containerized applications, making it easy to deploy new containers and scale up or down as needed.

High availability

Kubernetes provides high availability by automatically detecting and replacing failed containers, ensuring that applications remain available even if individual containers fail.

Resource utilization

Kubernetes provides a range of tools for managing resource utilization, including CPU and memory limits, as well as automatic scaling based on resource usage.

Self-healing

Kubernetes provides self-healing capabilities, which enable the system to automatically detect and recover from failures without requiring human intervention.

Service discovery and load balancing

Kubernetes provides built-in service discovery and load balancing capabilities, making it easy to expose containerized services and distribute traffic across multiple containers.

Rolling updates and rollbacks

Kubernetes supports rolling updates and rollbacks, making it easy to deploy new versions of applications without downtime or disruption.

Benefits of Kubernetes

Kubernetes provides a range of benefits for organizations that are looking to deploy and manage containerized applications. Here are some of the key benefits of Kubernetes:

Scalability

Kubernetes enables organizations to easily scale their containerized applications as demand grows, making it easy to manage large-scale applications.

Flexibility

Kubernetes is a flexible platform that can be used with a wide range of containerization technologies, including Docker and containerd.

Portability

Kubernetes provides a standardized platform for deploying and managing containerized applications, making it easy to deploy applications across different cloud providers and on-premises environments.

Automation

Kubernetes automates many of the tasks involved in deploying and managing containerized applications, making it easy to scale and manage large-scale applications without requiring significant human intervention.

Kubernetes Architecture

Kubernetes is built on a highly modular architecture that consists of several key components. These components work together to provide a powerful platform for deploying, scaling, and managing containerized applications. Here’s an overview of the key components of Kubernetes:

Master Node

The master node is the brain of the Kubernetes cluster. It runs the Kubernetes API server, which is the main control plane for the entire cluster. The API server is responsible for managing the state of the cluster, including the configuration and status of all the nodes and pods in the cluster.

The master node also runs several other key components, including the etcd datastore, the Kubernetes scheduler, and the Kubernetes controller manager. The etcd datastore is a distributed key-value store that stores the configuration data for the Kubernetes cluster. The scheduler is responsible for scheduling pods to run on the worker nodes in the cluster, while the controller manager is responsible for maintaining the desired state of the cluster.

Worker Nodes

The worker nodes are the machines in the cluster that run the containerized applications. Each worker node runs several key components, including the Kubernetes kubelet, the Kubernetes proxy, and the Docker runtime.

The kubelet is responsible for managing the state of the containers on the node, including starting and stopping containers as needed. The proxy is responsible for handling network traffic to and from the containers on the node. The Docker runtime is responsible for running the containers themselves.

Pods

A pod is the smallest deployable unit in Kubernetes. A pod can contain one or more containers, which are co-located and share the same network namespace. Pods are designed to be highly ephemeral, meaning that they can be created, updated, and destroyed quickly and easily.

Services

A service is a Kubernetes object that defines a logical set of pods and a policy for accessing them. Services provide a stable IP address and DNS name that can be used to access the pods, even as they are created and destroyed.

Deployments

A deployment is a Kubernetes object that manages a set of replica pods. Deployments are used to ensure that a desired number of replicas of a pod are running at all times. Deployments enable rolling updates and rollbacks of the replica set, making it easy to update the application without downtime or disruption.

Kubernetes is a highly modular container orchestration system that is built on a powerful architecture. The master node, worker nodes, pods, services, and deployments work together to provide a flexible, scalable platform for deploying and managing containerized applications. Whether you’re deploying a small-scale application or a large-scale distributed system, Kubernetes provides the tools and capabilities you need to manage your applications with ease.

Getting started with Kubernetes

If you’re interested in getting started with Kubernetes, there are a number of resources available to help you get started. The Kubernetes website provides extensive documentation, including a Getting Started Guide that walks you through the process of deploying your first Kubernetes cluster. Additionally, there are a number of Kubernetes tutorials and courses available online that can help you learn how to use Kubernetes.

Kubernetes is a powerful container orchestration system that provides a range of features and benefits for organizations that are looking to deploy and manage containerized applications. Whether you’re looking to scale your applications, improve resource utilization, or automate deployment and management tasks, Kubernetes is a great choice. With its flexible platform, built-in automation, and comprehensive documentation, Kubernetes is a powerful tool for managing containerized applications at scale. Some of the most commonly used commands of Kubernetes.

  1. kubectl get: This command is used to list the resources in a Kubernetes cluster. You can use this command to view the status of pods, services, deployments, and other resources. For example, kubectl get pods will list all the pods in the current namespace.
  2. kubectl describe: This command is used to view the details of a particular resource. You can use this command to view the details of a pod, service, deployment, or other resources. For example, kubectl describe pod <pod_name> will show the details of a specific pod.
  3. kubectl create: This command is used to create a new resource in the Kubernetes cluster. You can use this command to create a new pod, service, deployment, or other resources. For example, kubectl create -f <file_name> will create a new resource based on the YAML file.
  4. kubectl apply: This command is used to apply changes to an existing resource in the Kubernetes cluster. You can use this command to update the configuration of a pod, service, deployment, or other resources. For example, kubectl apply -f <file_name> will apply the changes specified in the YAML file.
  5. kubectl delete: This command is used to delete a resource in the Kubernetes cluster. You can use this command to delete a pod, service, deployment, or other resources. For example, kubectl delete pod <pod_name> will delete the specified pod.
  6. kubectl logs: This command is used to view the logs of a container running in a pod. You can use this command to troubleshoot issues and debug your applications. For example, kubectl logs <pod_name> <container_name> will show the logs of the specified container in the pod.
  7. kubectl exec: This command is used to execute a command in a container running in a pod. You can use this command to run commands inside a container for troubleshooting and debugging purposes. For example, kubectl exec <pod_name> <command> will run the specified command inside the container.
  8. kubectl port-forward: This command is used to forward a local port to a port on a pod. You can use this command to access services running in the pod from your local machine. For example, kubectl port-forward <pod_name> <local_port>:<pod_port> will forward the specified ports.
  9. kubectl scale: This command is used to scale a deployment or a replica set. You can use this command to increase or decrease the number of replicas of a particular resource. For example, kubectl scale deployment <deployment_name> --replicas=3 will scale the deployment to have three replicas.
  10. kubectl rollout: This command is used to manage rollouts of updates to a deployment. You can use this command to manage the deployment of new versions of your application. For example, kubectl rollout restart deployment <deployment_name> will restart the deployment with a new version of the application.

Kubernetes provides a powerful set of command-line tools that allow users to manage and operate their Kubernetes clusters. The above-mentioned commands are some of the most commonly used commands of Kubernetes. By using these commands, users can manage and deploy their containerized applications with ease.

--

--

Ankit Garg
Geek Culture

I write , So I learn @fullstackdev Go | JavaScript | Node js | React js