Create Deployments in Kubernetes Cluster Devops

Ticker

6/recent/ticker-posts

Create Deployments in Kubernetes Cluster Devops

Question :   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 platform. Recently one of the team members has been assigned a task to create a deploymnt 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) 



Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍

Solution:

1. At first  kubectl  utility configure and working from jump server, run below commands  

thor@jump_host /$ kubectl get deploy

No resources found in default namespace.

thor@jump_host /$

thor@jump_host /$  kubectl get namespace

NAME              STATUS   AGE

default           Active   58m

kube-node-lease   Active   58m

kube-public       Active   58m

kube-system       Active   58m

thor@jump_host /$

2.  Create deploy & and run image as per the task request

thor@jump_host /$ kubectl create deploy nginx --image nginx:latest

deployment.apps/nginx created

thor@jump_host /$


3.  Validate the task by running below commands

    

thor@jump_host /$ kubectl get deploy

NAME    READY   UP-TO-DATE   AVAILABLE   AGE

nginx   0/1     1            0           19s

thor@jump_host /$

thor@jump_host /$ kubectl get pods

NAME                     READY   STATUS    RESTARTS   AGE

nginx-55649fd747-8qq78   1/1     Running   0          76s

thor@jump_host /$

thor@jump_host /$ kubectl describe pod nginx-55649fd747-8qq78

Name:         nginx-55649fd747-8qq78

Namespace:    default

Priority:     0

Node:         node01/172.17.0.14

Start Time:   Wed, 16 Jun 2021 15:00:54 +0000

Labels:       app=nginx

              pod-template-hash=55649fd747

Annotations:  <none>

Status:       Running

IP:           10.244.1.2

IPs:

  IP:           10.244.1.2

Controlled By:  ReplicaSet/nginx-55649fd747

Containers:

  nginx:

    Container ID:   docker://3f15d91fa90ed005a110cae597c9632c46bfcf7d6441e85f199a3aa5e838a30a

    Image:          nginx:latest

    Image ID:       docker-pullable://nginx@sha256:6d75c99af15565a301e48297fa2d121e15d80ad526f8369c526324f0f7ccb750

    Port:           <none>

    Host Port:      <none>

    State:          Running

      Started:      Wed, 16 Jun 2021 15:01:24 +0000

    Ready:          True

    Restart Count:  0

    Environment:    <none>

    Mounts:

      /var/run/secrets/kubernetes.io/serviceaccount from default-token-2glf2 (ro)

Conditions:

  Type              Status

  Initialized       True

  Ready             True

  ContainersReady   True

  PodScheduled      True

Volumes:

  default-token-2glf2:

    Type:        Secret (a volume populated by a Secret)

    SecretName:  default-token-2glf2

    Optional:    false

QoS Class:       BestEffort

Node-Selectors:  <none>

Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s

                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s

Events:

  Type    Reason     Age   From               Message

  ----    ------     ----  ----               -------

  Normal  Scheduled  85s   default-scheduler  Successfully assigned default/nginx-55649fd747-8qq78 to node01

  Normal  Pulling    84s   kubelet            Pulling image "nginx:latest"

  Normal  Pulled     56s   kubelet            Successfully pulled image "nginx:latest" in 27.864467855s

  Normal  Created    55s   kubelet            Created container nginx

  Normal  Started    55s   kubelet            Started container nginx

thor@jump_host /$


4.  Click on Finish & Confirm to complete the task successful

Happy Learning!!!!

Apart from this if you need more clarity,  I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge 




Post a Comment

0 Comments

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user