Deploy ReplicaSet in Kubernetes Cluster KodeKloud Engineer Task Success

Ticker

6/recent/ticker-posts

Deploy ReplicaSet in Kubernetes Cluster KodeKloud Engineer Task Success

Question : The Nautilus DevOps team is gearing up to deploy applications on a Kubernetes cluster for migration purposes. A team member has been tasked with creating a ReplicaSet outlined below:

1. Create a ReplicaSet using httpd image with latest tag (ensure to specify as httpd:latest) and name it httpd-replicaset.

2. Apply labels: app as httpd_app, type as front-end.

3. Name the container httpd-container. Ensure the replica count is 4.

Note: The kubectl utility on jump_host is set up to interact with the Kubernetes cluster.


Please Note :-  Perform the below commands based on your question server,  user name & other details that 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 /$ kubectl get services

NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE

kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   3m28s

thor@jump_host /$

2.  Create  httpd.yaml  file with all the parameters given in task

    Refer Below Video for more clarity )

thor@jump_host /$ vi /tmp/httpd.yaml

thor@jump_host /$ cat /tmp/httpd.yaml

apiVersion: apps/v1

kind: ReplicaSet

metadata:

  name: httpd-replicaset

  labels:

    app: httpd_app

    type: front-end

spec:

  replicas: 4

  selector:

    matchLabels:

      app: httpd_app

  template:

    metadata:

      labels:

        app: httpd_app

        type: front-end

    spec:

      containers:

        - name: httpd-container

          image: httpd:latest

thor@jump_host /$



3.  Run below command to create pod

thor@jump_host /$ kubectl create -f /tmp/httpd.yaml

replicaset.apps/httpd-replicaset created

thor@jump_host /$



4.  Wait for  pods to get running status

thor@jump_host /$ kubectl get pods

NAME                     READY   STATUS    RESTARTS   AGE

httpd-replicaset-2qp9s   1/1     Running   0          32s

httpd-replicaset-4hgxw   1/1     Running   0          32s

httpd-replicaset-9ghzh   1/1     Running   0          32s

httpd-replicaset-cmrcq   1/1     Running   0          32s

thor@jump_host /$

 

5.  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

Deploy ReplicaSet in Kubernetes Cluster  KodeKloud Engineer Task Success