KodeKloud Engineer Kubernetes Tasks

Level 1-2. How to create a DEPLOYMENTS in Kubernetes cluster

KodeKloud Engineer Kubernetes Tasks

Photo by Growtika on Unsplash

Question 2:

The Nautilus DevOps team has started practicing some pods and services deployment on Kubernetes platform, as they are planning to migrate most of their applications on Kubernetes. Recently one of the team members has been assigned a task to create a deployment as per details mentioned below:

Create a deployment named nginx to deploy the application nginx using the image nginx:latest (remember to mention the tag as well)

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.

Solution :

- Note: I Highly recommend you not to COPY and PASTE the answers. Try to understand the concept first and then try to solve the question.

we are going to execute all these commands in jump host itself.

Before we start, let's check the presence of kubectl in our jump host.

$ kubectl version

  1. Creating Deployments in the cluster

    $ kubectl create deployment <deployment-name> --image=imagename:tag

    $ kubectl create deployment nginx --image=nginx:latest

    As per the question, we are creating the deployment named nginx in our kubernetes cluster with image nginx and tag latest.

what is Deployment ?

  • In Kubernetes, a deployment is a resource object that represents a desired state for a set of pods and provides declarative updates to pods and ReplicaSets. It manages the lifecycle of pods, including scaling, rolling updates, and restarts.

    • Deployments provide a way to declaratively manage the creation, updating, and deletion of pods. When you create a deployment, you specify the desired state of the pods, such as the number of replicas, the container image to use, and the resource requests and limits. Kubernetes will then work to ensure that the actual state of the pods matches the desired state.

what is POD ?

  • A pod is a fundamental building block of Kubernetes. It represents a group of one or more containers that are managed together. Pods provide a way to group related containers and manage them as a single unit. Each pod has its own IP address and can be assigned resources such as CPU and memory.
  1. Verification

    Now, we have created our deployment in the cluster, let's check that once before submission.

    $ kubectl get deployments

    It will gives us the list of deployments in our cluster.

    $ kubectl describe deployment nginx

    It will gives us the complete detailed information about our deployment.

    tip 🥴: In case you don't know / not getting command in our mind to create deployment then you can use $ kubectl create deployment --help it will give you the command template along with example .

    If Everything is good then, we can click on submit

    we will meet in the next article with another interesting topic, till then keep practising.

    please like 👍, follow Nagacharan , share and comment 💬your views on this article.

Did you find this article valuable?

Support Nagacharan by becoming a sponsor. Any amount is appreciated!