• +91 9723535972
  • info@interviewmaterial.com

DevOps Interview Questions and Answers

DevOps Interview Questions and Answers

Question - 71 : - How does chef-apply differ from chef-client?

Answer - 71 : -

chef-apply is run on the client system.

chef-apply applies the recipe mentioned in the command on the client system.

$ chef-apply recipe_name.rb

chef-client is also run on the client system.

chef-client applies all the cookbooks in your server's run list to the client system.

$ knife chef-client

Question - 72 : - Which open source or community tools do you use to make Puppet more powerful?

Answer - 72 : -

  • Changes in the configuration are tracked using Jira, and further maintenance is done through internal procedures. 
  • Version control takes the support of Git and Puppet's code manager app.
  • The changes are also passed through Jenkin's continuous integration pipeline.

Question - 73 : - What are the resources in Puppet?

Answer - 73 : -

  • Resources are the basic units of any configuration management tool.
  • These are the features of a node, like their software packages or services.
  • A resource declaration, written in a catalog, describes the action to be performed on or with the resource.
  • When the catalog is executed, it sets the node to the desired state.

Question - 74 : - What is a class in Puppet?

Answer - 74 : -

Classes are named blocks in your manifest that configure various functionalities of the node, such as services, files, and packages.

The classes are added to a node's catalog and are executed only when explicitly invoked.

Class apache (String $version = ‘latest’) {

package{

‘httpd’: ensure => $version,

before => File[‘/etc/httpd.conf’],}

Question - 75 : - When should I use '{{ }}'?

Answer - 75 : -

 use {{}} for variables, unless you have a conditional statement, such as "when: …". This is because conditional statements are run through Jinja, which resolves the expressions.

 For example:

      echo “This prints the value of {{foo}}”

      when : foo is defined

Using brackets makes it simpler to distinguish between strings and undefined variables.
         

Question - 76 : - What is the best way to make content reusable/redistributable?

Answer - 76 : -

There are three ways to make content reusable or redistributable in Ansible:

  • Roles are used to managing tasks in a playbook. They can be easily shared via Ansible Galaxy.
  • "include" is used to add a submodule or another file to a playbook. This means a code written once can be added to multiple playbooks.
  • "import" is an improvement of "include," which ensures that a file is added only once. This is helpful when a line is run recursively.

Question - 77 : - Explain the architecture of Docker.

Answer - 77 : -

  • Docker uses a client-server architecture.
  • Docker Client is a service that runs a command. The command is translated using the REST API and is sent to the Docker Daemon (server). 
  • Docker Daemon accepts the request and interacts with the operating system to build Docker images and run Docker containers.
  • A Docker image is a template of instructions, which is used to create containers.
  • Docker container is an executable package of an application and its dependencies together.
  • Docker registry is a service to host and distribute Docker images among users.

Question - 78 : - What are the commands used to create a Docker swarm?

Answer - 78 : -

  • Create a swarm where you want to run your manager node.

  • Docker swarm init --advertise-addr  
  • Once you've created a swarm on your manager node, you can add worker nodes to your swarm.
  • When a node is initialized as a manager, it immediately creates a token. In order to create a worker node, the following command (token) should be executed on the host machine of a worker node.

docker swarm join \ --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \ 192.168.99.100:2377

Question - 79 : - How do you run multiple containers using a single service?

Answer - 79 : -

  • It is possible to run multiple containers as a single service with Docker Compose.
  • Here, each container runs in isolation but can interact with each other.
  • All Docker Compose files are YAML files.

Question - 80 : -
Instead of YAML, what can you use as an alternate file for building Docker compose?

Answer - 80 : -

To build a Docker compose, a user can use a JSON file instead of YAML. In case a user wants to use a JSON file, he/she should specify the filename as given:


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners