DevOps(Day-39) : Jenkins Interview Questions (Part-2)
How to create a continuous deployment in Jenkins?
First, create a pipeline for your application and set up the environment.
Provide the necessary build stages with steps.
Configure the webhook on GitHub.
Make sure to make the enable the Git hook in Jenkins configure section.
Now when any changes are made in the code the build automatically gets triggered to build and deploy the code.
How build a job in Jenkins?
Log in to the Jenkins dashboard and navigate to create a new item.
create a freestyle project or pipeline for your application.
Configure the specifications of the project by enabling features.
Write the appropriate groovy or shell script required to run the project.
Click on Save and then build now.
Why do we use pipelines in Jenkins?
It is a combination of plugins that supports the integration and implementation of continuous delivery pipelines. It has an extensible automation server to create simple and complex delivery pipelines as code. A Pipeline is a group of events interlinked with each other in a sequence.
Is only Jenkins enough for automation?
No, many tools need to be configured to have smooth automation in DevOps.
Jenkins puts focus only on automating the project pipeline from building a code to deploying a code. But, in order to have fully automation there are tools like Ansible, Terraform, Chef,etc.
How will you handle secrets?
1. One-Time Passwords (OTPs)
One-time passwords help prevent user account takeovers by ensuring that a username-password combination can not be used more than once. While the account retains the username throughout, the user is sent an OTP every time they log in. This keeps Jenkins administrators’ and users’ accounts safe, preventing secrets from being exposed to unwanted individuals.2. Avoid Hard-Coding Secrets
Remove any secrets that have been hardcoded into CI/CD configuration and Jenkins files. This keeps sensitive credential information away from the pipeline, making it inaccessible to malicious actors.3. Reduce Attack Surface by Storing Secrets in Multiple Jenkins Files
Storing secrets in multiple files helps enforce the principle of least exposure for credentials. This makes credentials available to the minimum number of applications and users possible.4. Use Authorization Controls to Manage Secrets Permissions
Developer teams should configure security checks to ensure the application requesting resource access has the properties of a valid application. These applications should be able to access various resources based on permissions assigned in RBAC policies.5. Follow the Principle of Least Privilege
Only grant permissions to applications that absolutely need access to secrets within the pipeline. Teams should consistently audit permissions to maintain the principle of least privilege throughout the pipeline’s lifecycle.Explain diff stages in CI-CD setup.
Source Code Management: GitHub needs to be integrated with Jenkins or any CI-CD tool to fetch the source code from a remote repository.
Build steps: The shell commands or the Groovy pipeline code are written to build the code. For example, this can be used to create docker images.
Test: Some automated tests are run to check if the code is meeting the requirement.
Deploy: If the code passes all test cases it is deployed to Production.
Monitoring: To check the health status of the instance or the application some monitoring tools are used like Grafana, Prometheus, etc. This would help to determine the issue which can be fixed quickly.
Name some of the plugins in Jenkins.
Git Plugin
Docker plugin
Docker-compose plugin
Kubernetes plugin
Ansible Plugin
GitHub Plugin
Thanks for reading my article. Have a nice day.
Comments
Post a Comment