Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
Day1 – DevOps & Git
-----------------------
START - 10 AM IST
End - 6 PM IST
-----------------
5:30 - 6:00 - Assignment
1:30 - 2:30 - LUNCH BREAK
-----------------------------
11.30 - 15 mins -
4:00 - 15 mins -
=======================================
LAB -- on AWS
--------------------------
50% Demo & Discussion --- 50 % Lab..
============================================
1 Hour of Discussion
---------------------
======================================================
How to get started?
----------------------------
Lab # 1
https://www.devopsschool.com/blog/git-tutorial-git-basic-workflow/
Day 2 – GIT
==========================================
============================================
Authentication with Github?
--------------------------------------
HTTPS -----> PAT is not a github password
- https://www.devopsschool.com/blog/github-tutorials-how-to-generate-pat-in-github/
SSH ---> Upload ur pub key to github
- https://www.devopsschool.com/blog/how-to-generate-upload-your-public-key-to-github-for-ssh-access-on-github/
https://www.devopsschool.com/blog/git-tutorial-git-basic-workflow-working-with-remote-repo-at-github-com/
Day 2 – Docker
What is Docker?
=========================
Container mgmt tool/platform
From soloman kykes
in go
Free and Open Source
tool
- Save cost - PS --> VS --> Container(Less cpu+ram+s+nlc)
- Save time --- 1 day -- 5 min --- 1 sec
- imp Quality ----->
mgmt
vm - create - start - stop - start - restart - pause - unp - kill - rm
Container - create - start - stop - start - restart - pause - unp - kill - rm
Container
https://www.youtube.com/watch?v=zd2TgM_pxJI
FUNC -> is LIGHTWEIGHT APP RUNtime env
TECH -> Each container is havng
1 USER namespace
attached to
1 MOUNT NS
1 PID ns
1 NETWORK NS
COMPUTE ==
BOOTFS + ROOTFS + USERFS + APPFS
Kernal + ubuntu
--------------------------
os
VM = BOOTFS + ROOTFS + USERFS + APPFS
Container - ROOTFS + USERFS + APPFS
============================================================================
Architecture of Docker
------------------------------
HUMAN ----> Docker Client ---> Docker Server -----> ContainerD ----> Kernal
Containers work
======================================
Docker Engine
Components of Docker
=================================
Step 1 - Install Docker Engine
How to install Docker?
12 which docker
13 which dockerd
14 ps -eaf | grep ocker
15 which containerd
16 ps -eaf | grep usr/bin/docker
17 ps -eaf | gre containerd
18 ps -eaf | grep containerd
21 docker version
22 docker info
Step 2 - Decide which app and locate Docker image
VM Image --> BOOTFS + ROOTFS + USERFS + APPFS
Docker Image ---> ROOTFS + USERFS + APPFS
Step 3 - From Registry - https://hub.docker.com/
Step 4 - Container
create - start - stop - start - restart - pause - unp - kill - rm
DOCKER TUTORIALS
https://www.devopsschool.com/blog/?s=docker
26 docker images
27 docker pull httpd
28 docker images
29 clear
30 ls
31 docker ps
32 docker ps -a
33 docker images
34 docker create httpd
35 docker ps -a
36 docker start d0f4e67de127
37 docker ps -a
38 docker stop d0f4e67de127
39 docker ps -a
40 docker start d0f4e67de127
41 docker ps -a
42 docker restart d0f4e67de127
43 docker ps -a
44 clear
45 docekr ps
46 docker ps
47 docker pause optimistic_lewin
48 docker ps
49 docker stats
50 docker upause optimistic_lewin
51 docker unpause optimistic_lewin
52 docker stats
53 docker ps
54 docker kill d0f4e67de127
55 docker ps -a
56 docker rm d0f4e67de127
57 docker ps -a
58 docker create httpd
59 docker ps -a
60 history
PS VS Container
------------------------------------------------------------
is running is running is running
as long as as long as as long as
PID1 is running PID1 is running PID1 is running
KERNEL KERNEL ANYTHING
=============================================
RUN
---------------------------------------------------
pull + create + start + attach(attach to a pid1 executable of the container)
RUN -d
---------------------------------------------------
pull + create + start + DO NOT attach(attach to a pid1 executable of the container)
94 ls
95 docker run -itd ubuntu
96 docker ps
97 docker inspect 7d3038a7471b
98 curl http://172.17.0.5
99 clear
100 docker run -d -p 81:80 httpd
101 docker ps
102 docker run -d -p 82:80 httpd
103 history
Day 3 – Ansible
What is Ansible?
========================================
Configuration mgmt tool
(Server(S) Config)
in Python
Release
Ansible - CMD - FREE N OS
How to Write code in Ansible?
AWX - UI - FREE
Tower - UI - PAID
From Redhat
What there in Server?
----------------------------
file A C D
dir "
package I R U
services S S R E D
usr A E D
group
yum I U
cmd cmd - script
shell
Where does it stand in SDLC?
-============================================
PLAN - CODE - SCAN - BUILD - UT - PACK - Archive - DEPQA - AT - CC --- Release
------------------------------------------------------------------------
Jira GIT Sonar Maven Junit Packer Artifactory --- Ansible
https://devopsschool.com/path/
How ansible Works?
======================================
Human ----> Ansible Server(ACS) ---> Ansible Remote Server(ARS)
LINUX ANY
Ansible NA
-----------------------SSH----------- (LINUX)
-----------------------Winrm ----------- (Windows)
python python(linux)
ps3. + donet (windows)
-------------------------------------------------------------------
How to install ansible
Ansible Installation and Configuration Guide
ACS Components
--------------------------
Ansible
Executables
Modules - A code - Running in ARS. set with param. eg. copy
https://docs.ansible.com/ansible/2.9/modules/list_of_all_modules.html
https://docs.ansible.com/ansible/2.8/modules/modules_by_category.html
Plugins - A code - To empower ACS feature
Ansible Config - /etc/ansible/ansible.cfg
copy file -- cp src dest
----------------------
cmd param param
module param parma
Playbook
yaml file -- code which would run in ARS
Inventory
a file which contains IP add of ARS
=====================================================================
RUN ONE CMD
-----> cmd --------------------- Ansible Adhoc Cmd
-----> script ------------------ Playbook
===================================================================
Requirement
- Write a code in Ansible which would deploy web server in 100s
Psucode
- S1 - Install apache in ubuntu "ansible module for" + generic requirement - apt
- S2 - Copy Package to Web dir of Apache - copy
- S3 - Start and Enable Service - service
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
Coding
=========================================
ansible localhost -m apt -a"name=apache2 state=latest"
ansible localhost -m copy -a"src=index.html dest=/var/www/html/index.html"
ansible localhost -m service -a"name=apache2 state=started"
=========================================
======================================================
INVENTORY
-----------------------
LIST of Ipaddres of ARS
CMD 4.5.5.2
FILE
SCRIPT
ansible localhost -m apt -a"name=apache2 state=latest"
ansible localhost -m copy -a"src=index.html dest=/var/www/html/index.html"
ansible localhost -m service -a"name=apache2 state=started"
ansible all -i 52.90.127.191,54.242.87.241, -m apt -a"name=apache2 state=latest" -u ubuntu --key-file=node.pem -b
ansible all -i 52.90.127.191,54.242.87.241, -m copy -a"src=index.html dest=/var/www/html/index.html" -u ubuntu --key-file=node.pem -b
ansible all -i 52.90.127.191,54.242.87.241, -m service -a"name=apache2 state=started" -u ubuntu --key-file=node.pem -b
SSH AUTHENTICATION
--------------
username and pass
username and key
SSH AUTHORIZATION
-------------------
sudo without password
sudo with password
sudo with another user n pass
sudo with another user n key
ansible all -i inventory -m apt -a"name=apache2 state=latest" -u ubuntu --key-file=node.pem -b
ansible all -i inventory -m copy -a"src=index.html dest=/var/www/html/index.html" -u ubuntu --key-file=node.pem -b
ansible all -i inventory -m service -a"name=apache2 state=started" -u ubuntu --key-file=node.pem -b
root@ip-172-31-29-115:~# more inventory
[web]
52.90.127.191
54.242.87.241
[db]
4.5.6.7
3.4.5.6
7.8.82.2
ansible web -i inventory -m apt -a"name=apache2 state=latest" -u ubuntu --key-file=node.pem -b
ansible web -i inventory -m copy -a"src=index.html dest=/var/www/html/index.html" -u ubuntu --key-file=node.pem -b
ansible web -i inventory -m service -a"name=apache2 state=started" -u ubuntu --key-file=node.pem -b
ansible db -i inventory -m apt -a"name=apache2 state=latest" -u ubuntu --key-file=node.pem -b
========================================================
Playbook
YAML FILE
Contains PLAY
What is play
----------------------
Specification of
Hosts: localhost or all or anygroupname
Task(S):
Module and Its param
Module and Its param
Module and Its param
Module and Its param
=====================================
---
- name: Update web servers
hosts: web
tasks:
- name: Install Apache in ubuntu
ansible.builtin.apt:
name: apache2
state: present
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Start service apache2, if not started
ansible.builtin.service:
name: apache2
state: started
ansible-playbook -i inventory play.yaml -u ubuntu --key-file=node.pem -b
Requrement
- Installl mysql db
- start a db service
---
- name: Update DB servers
hosts: db
tasks:
- name: Install Apache in ubuntu
ansible.builtin.apt:
update_cache: true
ignore_errors: yes
- name: Install Apache in ubuntu
ansible.builtin.apt:
name: mysql-server
state: present
- name: Start service apache2, if not started
ansible.builtin.service:
name: mysql.service
state: started
ansible-playbook -i inventory db.yaml -u ubuntu --key-file=node.pem -b
Day 4 – Jenkins
Jenkins
============================================
- CI Tool
- Dev in JAVA
- Open Source and Free
- All feature is powered by - plugins
https://plugins.jenkins.io/
- Release
Jenkins =============================== Classic
Cloudbees Jenkins (Enterprise) - Paid
Blueocean
JenkinsX
What is CI?
============================
- Cont Integ
Auto Build + Auto Test
---------------------
imm feedback
https://devopsschool.com/path/
SDLC
Dev QA
======================================================== ==========================
--------------------------------------------
PLAN -> Code -> Scan -> Compile -> UT -> Package -> Archive -> Dep2QA -> AT -> CC
=================================================================================
|============================================ | =====================|
Build TesT
=====================================================================================
IMM FEEDBACK
Jira Git Sonar Maven jnit packer nexus Ansible Sel jacoc
==========================================================================================
CI TOOL
JENKINS
Integration
Feedback
Scheduling
How Jenkins Works?
======================================
YOU ------> Jenkins Master ----> Jenkins Slave(Node)
WEB Agent
How to install Jenkins?
-==--------------------------------
How to Create a JOB?
=========================
Jenkins Tutorials: Preparation of Jenkins Job Setup Checklist
=============================================
Question#1 – What is your programming Language
JAVA
Question#2 – Where is the source code for project?
Github
https://github.com/devopsschool-demo-labs-projects/helloworld-java-maven
Question#3 – How Frequently you want this JOB to be triggered?
daily
Question#4 – What is your Builders?
maven ant gradle
pom.xml build.xml build.gradle
goal target task
===================================================
compile - compile compile compile
test - test
package - package
Question# 5 – Whom you want to deliver Feedback of Job
devops@rajeshkumar.xyz
Configure Jenkins First job of Java Code base with Maven Build tool
=================================================================
Integration
Scheduling
Feedback
Integration
========================================================
Process of Integration
------------------------
S1 - installl a plugins
S2 - Config a plugins
SonarQube Server
SonarQube Scanner
S3 - Use inside a job
https://github.com/devopsschool-demo-labs-projects/java-sonarqube-helloworld-src
====================================================================
Scheduling
How to Schedule and Trigger a Jenkins job automatically?
Method 1 – AT CERTAIN TIME AKA Build periodically
Method 2 – AT CERTAIN TIME BUT Build only when there is Code changes AKA Poll SCM
Method 3 – Trigger using command line or script AKA Trigger builds remotely (e.g., from scripts)
Method 4 – Trigger this job if other job is triggerred AKA Build after other projects are built
Method 5 – Trigger a job when there is PUSH into Github AKA GitHub hook trigger for GITScm polling
Method 6 – Trigger a job when there is PUSH into Bitbucket AKA GitHub hook trigger for GITScm polling
Method 7 – Trigger another job after this Job AKA Post Build Action => Build Other project
Method 8 – Trigger a Jenkins jobs using Jenkins command line jar file
curl -X POST --user rajesh:114d384630ab71842ce148905f1500a43d http://54.84.88.44:8080/job/DevOpsSchool/job/compile/build?delay=0sec
Terraform
What is Terraform?
================================
IAAC
Coding for Infra
in Go
by Hashicorp
Release
community - cmd
enterprise - gui - hosted
cloud = gui on Cloud
What is Infra?
--------------------------
https://registry.terraform.io/browse/providers 4000 infra platform
Why Terraform?
-----------------------------
ONE CODING STAND FOR ALL 4000 PROVIDERS
How Terraform Works?
How to install terraform?
https://www.devopsschool.com/blog/terraform-install-configurations/
How to install provider?
using code
=====================================
.tf
--------ONE DIR--------
1.tf 2.tf 3.tf 4.tf
------------------------
ONE CODE
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.37.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "3.92.0"
}
}
}
provider "aws" {
# Configuration options
}
provider "azurerm" {
# Configuration options
}
$ terraform init
==============================================================
Resources name
its param
Resources name
its param
Resources name
its param
Resources name
its param
Resources name
its param
resource "aws_instance" "web" {
ami = "ami-0c7217cdde317cfec"
instance_type = "t3.micro"
tags = {
Name = "HelloWorld77777"
}
}
https://registry.terraform.io/providers/hashicorp/aws/latest/docs
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
terraform plan
terraform apply
terraform apply --auto-approve
terraform destory
terraform destroy --auto-approve
variable "instance_count" {
type = number
default = 1
}
variable "instance_name" {
type = string
default = "Rajesh"
}
resource "aws_instance" "example-number" {
count = var.instance_count
ami = "ami-0c7217cdde317cfec"
instance_type = "t2.micro"
tags = {
Name = var.instance_name
}
}
variable "security_groups" {
type = list(string)
default = ["sg-0751e756f0c838861"]
}
resource "aws_instance" "example-list" {
ami = "ami-0c7217cdde317cfec"
instance_type = "t2.micro"
vpc_security_group_ids = var.security_groups
}
variable "instance_tags" {
type = map(string)
default = {
Name = "my-instance4mMap-Rajesh"
}
}
resource "aws_instance" "example-map" {
ami = "ami-0c7217cdde317cfec"
instance_type = "t2.micro"
tags = var.instance_tags
}
variable "create_vm" {
description = "If set to true, it will create vm"
type = bool
}
resource "aws_instance" "example-bool" {
count = var.create_vm ? 1 : 0
ami = "ami-0c7217cdde317cfec"
instance_type = "t2.micro"
tags = var.instance_tags
}
=========================================================================
===========================================================================
Modules
--------------------------------------------
a Directory
where you have
- tf code
- tf vars
root module
main.tf
module [ compute]
module [ db]
child modile [ compute]
a Directory
where you have
- tf code
- tf vars
child modile [ db]
a Directory
where you have
- tf code
- tf vars
==============================================
resource "aws_instance" "example-number-mod1r" {
count = 1
ami = "ami-0c7217cdde317cfec"
instance_type = "t2.micro"
tags = {
Name = var.instance_name
}
}
resource "aws_instance" "example-number-mod1" {
count = 1
ami = "ami-0c7217cdde317cfec"
instance_type = "t2.micro"
tags = {
Name = var.instance_name
}
}
module "raju1" {
source = "./mod1"
}
module "raju2" {
source = "./mod2"
}
C:\Users\Rajesh Kumar\Desktop\DevOps\terar1>tree
Folder PATH listing for volume Windows
Volume serial number is DCF7-F64C
C:.
├───.terraform
│ ├───modules
│ └───providers
│ └───registry.terraform.io
│ └───hashicorp
│ ├───aws
│ │ └───5.37.0
│ │ └───windows_amd64
│ └───azurerm
│ └───3.92.0
│ └───windows_amd64
├───mod1
└───mod2
module "raju1" {
source = "./mod1"
}
module "raju2" {
source = "./mod2"
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "my-vpc"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
enable_nat_gateway = false
enable_vpn_gateway = false
tags = {
Terraform = "true"
Environment = "dev"
}
}
https://www.devopsschool.com/blog/?s=terraform+module