Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question:

1. Create a Deployment named as ic-deploy-devops.

2. Configure spec as replicas should be 1, labels app should be ic-devops, template's metadata lables app should be the same ic-devops.

3. The initContainers should be named as ic-msg-devops, use image centos, preferably with latest tag and use command '/bin/bash', '-c' and 'echo Init Done - Welcome to xFusionCorp Industries > /ic/ecommerce'. The volume mount should be named as ic-volume-devops and mount path should be /ic.

4. Main container should be named as ic-main-devops, use image centos, preferably with latest tag and use command '/bin/bash', '-c' and 'while true; do cat /ic/ecommerce; sleep 5; done'. The volume mount should be named as ic-volume-devops and mount path should be /ic.

5. Volume to be named as ic-volume-devops and it should be an emptyDir type.

Sample Answer: 

# first we need to create a configuration YAML file based on the given details in the question.

check below the Github link for the sample YAML file for this task.( init-container-deploy.yaml) 



#Hope you prepared the YAML file from the above step using your question details.
NOW let's do the task.

 #deploy the file 

        kubectl apply -f <your-yaml-file>

#checking

    kubectl get pods


Note: **The Question copied for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

check the below video too for how to do this task (i have done a sample task on Ubuntu OS)


LIKE, SUBSCRIBE my channel and stay tuned for more videos


Answer for Kodekloud DEVOPS Questions - Create Replicaset in Kubernetes Cluster

The Nautilus DevOps team is going to deploy some applications on kubernetes cluster as they are planning to migrate some of their applications there. Recently one of the team members has been assigned a task to write a template as per the details mentioned below:

1. Create a ReplicaSet using httpd image with latest tag only and remember to mention tag i.e httpd:latest and name it as httpd-replicaset.

2. Labels app should be httpd_app, labels type should be front-end. The container should be named as httpd-container; also make sure replicas counts are 4.


Sample Answer: 

# first we need to create a replicate-set YAML file based on the given details in the question.

check below the Github link for the sample YAML file for this task.( replica-set.yaml) 



#Hope you prepared the YAML file from the above step using your question details.
NOW let's do the task.

 #deploy the file 

        kubectl apply -f replica-set.yaml

#checking

    kubectl get pods

Note: **The Question copied for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

check the below video too for how to do this task (i have done a sample task on Ubuntu OS)



Answer for Kodekloud DEVOPS Questions - Puppet create a file

The Puppetmaster and Puppet agent nodes have been set up by the Nautilus DevOps team so they can perform testing. In Stratos DC all app servers have been configured as Puppet agent nodes. Below are details about the testing scenario they want to proceed with.

Use Puppet file resource and perform the task below:

1. Create a Puppet programming file ecommerce.pp under /etc/puppetlabs/code/environments/production/manifests directory on master node i.e Jump Server.

2. Using /etc/puppetlabs/code/environments/production/manifests/ecommerce.pp create a file media.txt under /opt/security directory on App Server 1.

Note: Please perform this task using ecommerce.pp only, do not create any separate inventory file.


Sample Answer: 

        # create the .pp file with the name given in the question

                vi <file-name>.pp


        # add configuration as per the  

    node '<app-server-hostname>' {
file { '<path-given-in the question-with the file name>':
ensure => 'present',
path   => '<path-given-in the question-with the file name'}
}

# login to the app server and run 

                puppet agent -vt 

# check the path that file was created successfully 

Note: **The Question copied it for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

Answer for Kodekloud DEVOPS Questions - Environment Variables in Kubernetes

 Question: Read the full details of your question. 

sample Answer:

# first we need to create a configuration YAML file based on the given details in the question.

check below the Github link for the sample YAML file for this task.( filedref-pod.yaml) 



#Hope you prepared the YAML file from the above step using your question details.
NOW let's do the task.

# create namespace based on your question 
    
    kubectl create ns <namespace-name_from_your_question>

# pod creation 
    
    kubectl apply -f <your.yaml file> -n <namespace-name_from_your_question>

#get status of pod 
    
    kubectl get pods -n <your-name space-name>


#Testing 

    To check the output, exec the pod and use printenv command.


Note: Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

check the below video too for how to do this task (i have done a sample task on Ubuntu OS)



*Please comment on this post if you have any questions or facing any issues in the above steps, also provide your feedback in the comments :)

Featured Post

Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question: 1. Create a Deployment named as ic-deploy-devops. 2. Configure spec as replicas should be 1 , labels app should be ic-devops , ...