Skip to content
Open

j #2

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1375904
Merge pull request #1 from RAHAMSHAIK007/main
summu97 Dec 13, 2023
53a4c89
Merge pull request #2 from RAHAMSHAIK007/main
summu97 Dec 14, 2023
6844890
Update day-04
summu97 Dec 14, 2023
9493ecc
Update day-04
summu97 Dec 14, 2023
8f9369d
Create nexus-pipeline
summu97 Dec 15, 2023
0510818
Merge pull request #3 from RAHAMSHAIK007/main
summu97 Dec 19, 2023
0656c91
Rename day-6 to day-06
summu97 Dec 19, 2023
97a62c9
Merge pull request #4 from RAHAMSHAIK007/main
summu97 Dec 20, 2023
c29e849
Merge pull request #5 from RAHAMSHAIK007/main
summu97 Dec 21, 2023
e8fab47
Create project-ansible-jenkins
summu97 Dec 21, 2023
5f697e4
Merge pull request #6 from RAHAMSHAIK007/main
summu97 Dec 23, 2023
d6ef5c0
Update day-08
summu97 Dec 23, 2023
6182a5a
Merge pull request #7 from RAHAMSHAIK007/main
summu97 Dec 23, 2023
095209a
Merge pull request #8 from RAHAMSHAIK007/main
summu97 Dec 26, 2023
1f03671
Create LAMP-stack
summu97 Dec 27, 2023
54a205b
Merge pull request #9 from RAHAMSHAIK007/main
summu97 Dec 28, 2023
40458bd
Update LAMP-stack
summu97 Dec 28, 2023
cf6fd9d
Update LAMP-stack
summu97 Dec 28, 2023
527542a
Update LAMP-stack
summu97 Dec 28, 2023
9683abe
Update LAMP-stack
summu97 Dec 28, 2023
05ebd03
Update day-14
summu97 Dec 28, 2023
eba2cde
Merge pull request #10 from RAHAMSHAIK007/main
summu97 Dec 29, 2023
e02b8e4
Merge pull request #11 from RAHAMSHAIK007/main
summu97 Jan 2, 2024
9752231
Create metric-server.sh
summu97 Jan 2, 2024
5c23c7a
Update day-17
summu97 Jan 2, 2024
e0a8781
Update day-17
summu97 Jan 2, 2024
df47e6a
Update metric-server.sh
summu97 Jan 2, 2024
a4bc10c
Update and rename metric-server.sh to metric-server.sh , HPA
summu97 Jan 2, 2024
c97658f
Update day-17
summu97 Jan 2, 2024
3753b28
Merge pull request #12 from RAHAMSHAIK007/main
summu97 Jan 3, 2024
2b3012d
Create configmaps and secrets
summu97 Jan 3, 2024
7fcb59b
Merge pull request #13 from RAHAMSHAIK007/main
summu97 Jan 4, 2024
ca0deb6
Merge pull request #14 from RAHAMSHAIK007/main
summu97 Jan 5, 2024
2365b9b
Merge pull request #15 from RAHAMSHAIK007/main
summu97 Jan 6, 2024
b23f71b
Merge pull request #16 from RAHAMSHAIK007/main
summu97 Jan 8, 2024
de7fd84
Merge pull request #17 from RAHAMSHAIK007/main
summu97 Jan 9, 2024
b947c1a
Merge pull request #18 from RAHAMSHAIK007/main
summu97 Jan 10, 2024
ac3c4af
Merge pull request #19 from RAHAMSHAIK007/main
summu97 Jan 11, 2024
137a786
Rename day-01 to 01 - git
summu97 Jan 20, 2024
f8a8168
Rename day-10 to 10 - docker
summu97 Jan 20, 2024
3b63338
Rename day-11 to 11 - docker
summu97 Jan 20, 2024
eae9bee
Rename day-12 to 12 - docker
summu97 Jan 20, 2024
d95c64d
Rename day-13 to 13 - docker
summu97 Jan 20, 2024
eef5dd3
Rename day-20 to 20 - tfm
summu97 Jan 20, 2024
110dae8
Rename day-06 to 06 - ansible
summu97 Jan 21, 2024
b3a2d67
Update 06 - ansible
summu97 Jan 21, 2024
0405791
Rename day-07 to 07 - ansible
summu97 Jan 21, 2024
aae49be
Rename day-08 to 08 - ansible
summu97 Jan 21, 2024
114e4ed
Rename day-09 to 09 - ansible
summu97 Jan 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
1 change: 1 addition & 0 deletions day-06 → 06 - ansible
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,4 @@ TO EXECUTE: ansible-playbook playbbok.yml
- docker*
- java-1.8.0-openjdk*
- tree*
ansible-playbook playbook.yml --syntax (this will show any errors in playbook)
File renamed without changes.
10 changes: 10 additions & 0 deletions day-08 → 08 - ansible
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,13 @@ dev-2: mysql -- > ms
test-1: python -- > py
test-2: NumPy and Pandas -- > n & p

- hosts: all
tasks:
- name: installing apache
yum: name=httpd state=present
- name: installing mysql
yum: name=mysql state=present
- name: installing python
yum: name=python3 state=present


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
55 changes: 55 additions & 0 deletions LAMP-stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
The LAMP stack is a popular open-source software stack used for web development.
Linux

Apache

MySQL
MySQL: This is the relational database management system (RDBMS) used to store and manage the website's data.

PHP/Python/Perl
-> PHP is a server-side scripting language used for developing dynamic web pages.

WEB:"web" typically refers to the World Wide Web, which is a global information space accessible via the internet.

"stack" refers to a set of software that is commonly used together to enable the hosting of dynamic websites and web applications.

1. Install Apache:
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2 (this is similar to chkconfig)

2. Install MySQL:
sudo apt install mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql

3. Install PHP:
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2

Test Your LAMP Stack:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Additional Considerations:
Ensure that your firewall allows traffic on the necessary ports (80 for HTTP, 443 for HTTPS).
Secure your MySQL installation by running the MySQL secure installation script: sudo mysql_secure_installation.


for amazon linux:
sudo yum update
sudo yum install httpd
sudo service httpd start
sudo chkconfig httpd on

sudo yum install mysql-server
sudo service mysqld start
sudo chkconfig mysqld on

sudo mysql_secure_installation
This script will prompt you to set a root password, remove anonymous users, and more.

sudo yum install php php-mysql
sudo service httpd restart

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
28 changes: 28 additions & 0 deletions configmaps and secrets
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
to pass env variables using ENV

kubectl create deploy deployname --image=mariadb
kubectl set env deploy deployname MYSQL_ROOT_PASSWORD=sumo97
cmnd: kubectl get po
cmnd: kubectl delete deploy deployname

to pass env variables using ENVFROM-file

vim abc
MYSQL_ROOT_PASSWORD=sumo97
MYSQL_USER=admin

kubectl create cm cmname --from-env-file=abc
kubectl get cm
kubectl describe cm cmname
kubectl create deploy deployname --image=mariadb
kubectl get po
kubectl set env deploy deployname --from=configmap/cmname
kubectl get po
kubectl delete deploy deployname

SECRETS:
kubectl create deploy deployname --image=mariadb
kubectl get po
kubectl create secret generic pswdname --from-literal=ROOT_PASSWORD=sumo97
kubectl get secrets
kubectl describe secrets
85 changes: 18 additions & 67 deletions day-04
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ S : STEPS

SINGLE STAGE: this pipeline will have only one stage.


pipeline {
agent any

Expand All @@ -54,18 +53,6 @@ pipeline {
}


pipeline {
agent any

stages {
stage('raham') {
steps {
sh 'touch file2'
}
}
}
}

MULTI STAGE: this pipeline will have more than one stage.

EXAMPLE-1:
Expand All @@ -86,23 +73,6 @@ pipeline {
}
}

EXAMPLE-2:
pipeline {
agent any

stages {
stage('cpu') {
steps {
sh 'lscpu'
}
}
stage('mem') {
steps {
sh 'lsmem'
}
}
}
}


CI PIPELINE:
Expand Down Expand Up @@ -193,25 +163,6 @@ pipeline {
}
}

EXAMPLE-2:
pipeline {
agent any

stages {
stage('one') {
steps {
git 'https://github.com/devopsbyraham/jenkins-java-project.git'
sh '''
mvn compile
mvn test
mvn package
mvn install
mvn clean package
'''
}
}
}
}

USER INPUT:
pipeline {
Expand Down Expand Up @@ -329,26 +280,26 @@ ALTERNATIVES: NGINX, IIS, WEBSPHERE, JBOSS, GLASSFISH


SETUP:
INSTALL JAVA: amazon-linux-extras install java-openjdk11 -y

STEP-1: DOWNLOAD TOMCAT (dlcdn.apache.org)
vim tomcat.sh
#
amazon-linux-extras install java-openjdk11 -y
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.83/bin/apache-tomcat-9.0.83.tar.gz

STEP-2: EXTRACT THE FILES
tar -zxvf apache-tomcat-9.0.83.tar.gz
sed -i '56 a\<role rolename="manager-gui"/>' apache-tomcat-9.0.83/conf/tomcat-users.xml
sed -i '57 a\<role rolename="manager-script"/>' apache-tomcat-9.0.83/conf/tomcat-users.xml
sed -i '58 a\<user username="tomcat" password="raham123" roles="manager-gui, manager-script"/>' apache-tomcat-9.0.83/conf/tomcat-users.xml
sed -i '59 a\</tomcat-users>' apache-tomcat-9.0.83/conf/tomcat-users.xml
sed -i '56d' apache-tomcat-9.0.83/conf/tomcat-users.xml
sed -i '21d' apache-tomcat-9.0.83/webapps/manager/META-INF/context.xml
sed -i '22d' apache-tomcat-9.0.83/webapps/manager/META-INF/context.xml
sh apache-tomcat-9.0.83/bin/startup.sh
#

STEP-3: CONFIGURE USER, PASSWORD & ROLES
vim apache-tomcat-9.0.83/conf/tomcat-users.xml

56 <role rolename="manager-gui"/>
57 <role rolename="manager-script"/>
58 <user username="tomcat" password="raham123" roles="manager-gui, manager-script"/>

STEP-4: DELETE LINE 21 AND 22
vim apache-tomcat-9.0.83/webapps/manager/META-INF/context.xml
NOTE:
copy code from # to # and run the script i.e, sh tomcat.sh

STEP-5: STARTING TOMCAT
sh apache-tomcat-9.0.83/bin/startup.sh
TO SHUTDOWN THE TOMCAT SERVER:
sh apache-tomcat-9.0.83/bin/shutdown.sh

CONNECTION:
COPY PUBLIC IP:8080
Expand Down Expand Up @@ -394,9 +345,9 @@ pipeline {
steps {
deploy adapters: [
tomcat9(
credentialsId: '056c3140-9f77-44c0-8b85-1f1435b918ea',
credentialsId: 'give cred id that you create',
path: '',
url: 'http://3.84.101.170:8080/'
url: 'http://3.84.101.170:8080/'#(give tomcat url)
)
],
contextPath: 'netflix',
Expand Down
1 change: 1 addition & 0 deletions day-14
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ NOTE: When you download a command as binary file it need to be on /usr/local/bin
because all the commands in linux will be on /usr/local/bin
and need to give executable permission for that binary file to work as a command.

A binary file is a computer file that contains data in a format that is not intended for humans to read.


POD:
Expand Down
73 changes: 1 addition & 72 deletions day-17
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ kubectl get al1

now opne second terminal
kubectl get po
kubectl exec mydeploy-6bd88977d5-7s6t8 -it -- /bin/bash
kubectl exec pod_name_id -it -- /bin/bash (this will not take you inside )

go to terminal one
kubectl get all : it will observer for every 2 seconds
Expand All @@ -227,74 +227,3 @@ now if the load gets down then after 5 minutes all the pods will go
these 5 minutes is called as cooldown period



history:
oot@ip-172-31-47-225 ~]# history
1 vim kops.sh
2 vim .bashrc
3 sh kops.sh
4 source .bashrc
5 sh kops.sh
6 kops validate cluster --wait 10m
7 cat kops.sh
8 kops validate cluster --wait 10m
9 export KOPS_STATE_STORE=s3://cloudanddevopsbyraham8899007.k8s.local
10 kops validate cluster --wait 10m
11 kubectl get svc
12 vim abc.yml
13 kubectl create -f abc.yml
14 kubectl get svc,deploy
15 kubectl delete -f abc.yml
16 vim abc.yml
17 kubectl create -f abc.yml
18 kubectl get svc,deploy
19 kubectl get po -o wide
20 kubectl delete -f abc.yml
21 vim abc.yml
22 kubectl create -f abc.yml
23 kubectl get svc,deploy
24 vim abc.yml
25 kubectl apply -f abc.yml
26 kubectl get svc,deploy
27 kubectl delete -f abc.yml
28 vim abc.yml
29 kubectl create -f abc.yml
30 kubectl get svc,deploy
31 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
32 minikube addons enable metrics-server #(only for minikube)
33 kubectl top nodes
34 kubectl top pods
35 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
36 kubectl top po
37 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml
38*
39 kubectl top po
40 kubectl top NO
41 kubectl top no
42 vim abc.yml
43 cat abc.yml
44 kubectl create -f abc.yml
45 vim abc.yml
46 kubectl create -f abc.yml
47 vim abc.yml
48 kubectl create -f abc.yml
49 vim abc.yml
50 cat abc.yml
51 vim abc.yml
52 kubectl create -f abc.yml
53 cat r
54 cat abc.yml
55 vim abc.yml
56 kubectl create -f abc.yml
57 vim abc.yml
58 kubectl create -f abc.yml
59 kubectl get po
60 kubectl get deploy
61 kubectl delete deploy swiggy-deploy
62 kubectl get deploy
63 kubectl autoscale deployment mydeploy --cpu-percent=20 --min=1 --max=10
64 kubectl get po
65 kubectl exec -it mydeploy-c5d4f9cbb-flsgk -- /bin/bash
66 kubectl get po
67 history

32 changes: 32 additions & 0 deletions metric-server.sh , HPA
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FOR MINIKUBE:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
minikube addons enable metrics-server #(only for minikube)

FOR KOPS:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml

kubectl top nodes
kubectl top pods
kubectl get po --watch (THIS WILL MONITOR ALL POD ACTIVITIES)



HORIZONTAL POD AUTOSCALLING: HPA

TO SET MIN AND MAX POD LEVELS:

kubectl autoscale deploy deployment_name --cpu-percent=20 --min=5 --max=10

STRESS ON PODS:

kubectl exec -it pod_name -- /bin/bash (this will execute command by going inside of pod)

if image OS is UBUNTU
for stress: apt install stress -y
run the last command to increase stress on pod
cmnd: stress

if image OS is linux
cmnd: amazon-linux-extras install epel -y
cmnd: yum install stress -y
Loading