Learn About Kubernetes (K8s) Objects

I recently completed the AWS EKS K8S training from AWS. The company I work for is going to be shifting as many workloads as possible to Kubernetes, so it’s something I need to learn. A lot has changed in K8s since I used it in 2018 on the Google Cloud Platform.

In this article, you will learn the basics about all of the objects that make up a Kubernetes cluster.

What is a Kubernetes Cluster?

The cluster is a logical collection of Kubernetes objects.

It is made up of:

  • a collection of nodes
  • has a minimum of 1 worker 
  • has a control plane

The cluster is the heart of Kubernetes and provides the capability to schedule and run containers across a group of machines, instances, or virtual machines. Clusters can be run locally, in the cloud, or span both on-premise and offsite, making them extremely flexible.

The cluster has a desired state configuration, and the state defines what workloads should be running on the cluster. The cluster manages the desired state by allocating resources as needed. If the desired state is 3 nodes, Kubernetes will ensure there are 3 resources running at all times.

What is a Kubernetes Node?

A Kubernetes node is a worker machine. In AWS, it is a cloud instance. The control plane manages the nodes.

https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/

Nodes are:

  • a group of containers
  • either a virtual or physical instance
  • managed by the control plane and contains services needed to run the pods

Each node runs (at least) the Kubelet process and a container runtime (typically docker)

What is a Kubernetes Pod?

A pod is a group of containers that share storage, network resources and a podspec file. Each pod runs one or more application containers that are coupled together.

To compare with Docker, a Pod is similar to a group of Docker containers with shared namespaces and shared filesystem volumes.

Pods are:

  • A group of one or more containers.
  • pods defined by PodSpec file.
  • Pods are building blocks of K8s for deployment, scaling, and replication.
  • Pods can run a single container.
  • Pods can run multiple continers that need to work together. (For example, when scaling horizontally)
  • Pods have init containers that run and complete before the app containers are started.
  • Pods are ephemeral.

What is an Ephemeral Volume?

Some applications need disk space for caching or read-only data for config files or secret keys. Ephemeral Volumes are used for these purposes and follow the Pods lifecycle because each ephemeral volume is created and destroyed with the pod.

There are four types of Ephemeral Volumes:

To summarize, Ephemeral Volumes are:

  • shared storage volume for the pod
  • Persistence of data when container restarts
  • When pod ceases, K8s destroy ephemeral vols

Persistent Vol

  • Same as Ephemeral but with lifecycle rules

What is a Kubernetes Service?

The service exposes the appication on the pods as a network service, including an IP address and DNS entry. Kubernetes Services are used to keep track of all network allocations (e.g Front-end and Back-End application endpoints)

  • Service is a logical collection of pods and access points.

Services is a huge subject within Kubernetes, you will find detailed information here

What is a Kubernetes Namespace?

A namespace is used to isolate groups of resources within a cluster.

  • Virtual cluster back by same physical cluster
  • Namespaces are especially useful when multiple teams or projects use the same cluster.

What is a ReplicaSet?

The replicaset is tasked with ensuring that the required number of pods are running at a given time.

  • Ensures that a specific number of pod replicas are running at any given time

That it for part 1 of objects. We will be back with part 2 shortly

Elsewhere On TurboGeek:  How to Write A Jenkinsfile

Richard.Bailey

Richard Bailey, a seasoned tech enthusiast, combines a passion for innovation with a knack for simplifying complex concepts. With over a decade in the industry, he's pioneered transformative solutions, blending creativity with technical prowess. An avid writer, Richard's articles resonate with readers, offering insightful perspectives that bridge the gap between technology and everyday life. His commitment to excellence and tireless pursuit of knowledge continues to inspire and shape the tech landscape.

You may also like...

1 Response

  1. 05/10/2023

    […] into the world of Kubernetes on Google Cloud Platform (GCP)? This introductory guide is tailor-made for beginners, walking you […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate ยป