Kubernetes objects – in simple language for beginners

kubernetes objects

Entities which Kubernetes keeps to maintain states are Kubernetes objects. Like Deployments, SatefulSet, DaemonSet etc.

These objects are responsible to define the current situation of the cluster as well as the desired situation.

For example, suppose you wanted to run 2 replicas of a pod but only 1 is running, then Kubernetes will know about it and try to run the 2nd replica.

What Kubernetes Objects Represents?

Basically they represents the state of the cluster. Like –

  • Information about the running containerized applications.
  • Resource utilization like CPU, Memory, Storage etc.
  • Policies attached to those containers like restart, upgrades etc.

Main Components of Kubernetes Objects

There are 2 main components –

  1. spec
  2. status

spec defines the properties. Like in deployment file we set spec for number of replicas. This commands Kubernetes to maintain the given number of replicas for the pod.

status represents the current state of cluster. Like the resource utilization by a pod.

Kubernetes keeps these two components in sync and if they behave differently then K8s takes the necessary action.

For example, if spec defines 2 replicas and status shows that only 1 is running then it means both spec and status are out of sync. Kubernetes will immediately run a new replica to match the spec.

Types of Kubernetes Objects

There are many types of Kubernetes objects. Some of them are listed below –

  • Deployments
  • StatefulSets
  • ReplicaSet
  • DaemonSet
  • Jobs
  • CronJob

How to create a Kubernetes object?

We create Kubernetes objects using yaml or json files. An example of Deployment yaml file is shown below –

apiVersion: apps/v1
kind: Deployment
  name: nginx-deployment
    app: nginx
  replicas: 3
      app: nginx
        app: nginx
      - name: nginx
        image: nginx:1.14.2
        - containerPort: 80

The most important parameters are –

  1. apiVersion
  2. kind
  3. metadata
  4. spec

Different types of objects will have different values for these fields. kind represents the type of object. For Deployments, the value of kind is Deployment.


Kubernetes objects are the persistent entities which represents the state of the cluster. spec and status are the two main components which defines the working conditions of a cluster.

Kubernetes uses these objects to keep the system running according to the protocols defined by the user.