GCP-DevOps-projectintroduxtionfir devopsproject.pdf

Masar10 52 views 178 slides Aug 01, 2024
Slide 1
Slide 1 of 178
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113
Slide 114
114
Slide 115
115
Slide 116
116
Slide 117
117
Slide 118
118
Slide 119
119
Slide 120
120
Slide 121
121
Slide 122
122
Slide 123
123
Slide 124
124
Slide 125
125
Slide 126
126
Slide 127
127
Slide 128
128
Slide 129
129
Slide 130
130
Slide 131
131
Slide 132
132
Slide 133
133
Slide 134
134
Slide 135
135
Slide 136
136
Slide 137
137
Slide 138
138
Slide 139
139
Slide 140
140
Slide 141
141
Slide 142
142
Slide 143
143
Slide 144
144
Slide 145
145
Slide 146
146
Slide 147
147
Slide 148
148
Slide 149
149
Slide 150
150
Slide 151
151
Slide 152
152
Slide 153
153
Slide 154
154
Slide 155
155
Slide 156
156
Slide 157
157
Slide 158
158
Slide 159
159
Slide 160
160
Slide 161
161
Slide 162
162
Slide 163
163
Slide 164
164
Slide 165
165
Slide 166
166
Slide 167
167
Slide 168
168
Slide 169
169
Slide 170
170
Slide 171
171
Slide 172
172
Slide 173
173
Slide 174
174
Slide 175
175
Slide 176
176
Slide 177
177
Slide 178
178

About This Presentation

Project


Slide Content

© Copyright KodeKloud

© Copyright KodeKloud

© Copyright KodeKloud

© Copyright KodeKloud
Creating a new GitHub repo

© Copyright KodeKloud
Setting up the repo according to
the company's best practices

© Copyright KodeKloud
Coding
Writing a code for a simple
docker image

© Copyright KodeKloud
Testing the code locally

© Copyright KodeKloud
Pushing the code to the
GitHub repo

© Copyright KodeKloud
GitHub Docker

© Copyright KodeKloud
Task 1
Creating a GitHub Repo

© Copyright KodeKloud
Creating a GitHub
Repository

© Copyright KodeKloud
Task 2
Cloning the repo and setting up our editor

© Copyright KodeKloud

© Copyright KodeKloud

© Copyright KodeKloud
Summary
Clone Setup Change Code

© Copyright KodeKloud
Task 3
Setting up GitHub repo according to
DevOps best practices

© Copyright KodeKloud

© Copyright KodeKloud
How to set up the GitHub repo?

© Copyright KodeKloud
GitHub Main Clone Make a
change

© Copyright KodeKloud
What is the Problem with this approach?

© Copyright KodeKloud
GitHub Main Clone Make a
change

© Copyright KodeKloud
GitHub Main Clone Make a
change
Conflict

© Copyright KodeKloud
How to improve?

© Copyright KodeKloud
Branch Protection

© Copyright KodeKloud
GitHub Main Clone Make a
change
Pool Request

© Copyright KodeKloud
GitHub Main Clone Feature
Branch
(task)
Pool RequestEngineer
Reviewed

© Copyright KodeKloud
How to enable Branch Protection?

© Copyright KodeKloud
Task 4
Coding for our application locally

© Copyright KodeKloud
Develop code locally
and test it.

© Copyright KodeKloud
VS Code Editor

© Copyright KodeKloud
Demo
Testing, Debugging our code locally

© Copyright KodeKloud
Sprint-01
Review

© Copyright KodeKloud
Sprint Review in Organizations
Creating a new GitHub repo
Setting up the repo according to the company's best practices
Coding: Writing a code for a simple docker image
Testing the code locally
Pushing the code to the GitHub repo

© Copyright KodeKloud

© Copyright KodeKloud
Sprint-02

© Copyright KodeKloud

© Copyright KodeKloud
Creating a GCP account

© Copyright KodeKloud
Understanding the
fundamentals of GKE in GCP

© Copyright KodeKloud
Setting up a GKE cluster

© Copyright KodeKloud
Sprint Goals
Creating a GCP account
Understanding the fundamentals of GKE in GCP
Setting up a GKE cluster

© Copyright KodeKloud
Kubernetes Refresher

© Copyright KodeKloud

© Copyright KodeKloud
Definition of Kubernetes
Kubernetes, also known as K8s, is an open-
source system for automating the
,
and
of containerized applications.

© Copyright KodeKloud
How do we create it?

© Copyright KodeKloud

© Copyright KodeKloud
Deploy it
Scale it
Manage it

© Copyright KodeKloud

© Copyright KodeKloud
Kubernetes Features
Automated Rollouts and Rollbacks
Docker Image Version Production Pod
Version Production Pod
Achieving this
task is known
as
Pug

© Copyright KodeKloud
Kubernetes Features
Self -Healing
Service Discovery and Load Balancing
Security and Configuration Management

© Copyright KodeKloud
Where do we deploy the Kubernetes?

© Copyright KodeKloud
Cloud Options
AWS GCP Microsoft Azure

© Copyright KodeKloud
Own Datacentres

© Copyright KodeKloud
Pros & Cons
Organization
Cost
Big Team

© Copyright KodeKloud
How to setup the Kubernetes cluster in GCP?

© Copyright KodeKloud
Sprint-02 review

© Copyright KodeKloud
Sprint Review
Creating a GCP account
Understanding the fundamentals of GKE in GCP
Setting up a GKE cluster

© Copyright KodeKloud

© Copyright KodeKloud
Sprint-03

© Copyright KodeKloud
Design Discussion on CI/CD
CI CD

© Copyright KodeKloud
What is Design Discussion?

© Copyright KodeKloud

© Copyright KodeKloud
Google Cloud Platform
GKE

© Copyright KodeKloud
What is the next step?

© Copyright KodeKloud

© Copyright KodeKloud
How do we achieve this?

© Copyright KodeKloud
CI/CD

© Copyright KodeKloud
What are the steps required?

© Copyright KodeKloud
Design Discussion
CI CD

© Copyright KodeKloud
CI/CD Design Discussion

© Copyright KodeKloud

© Copyright KodeKloud
What are the steps required?

© Copyright KodeKloud
GitHub GKE
Automated way to build the docker
image.

© Copyright KodeKloud
GitHub GKE
We have to store the Docker image
in an artifactory.

© Copyright KodeKloud
Where do we store Docker image?

© Copyright KodeKloud

© Copyright KodeKloud
GitHub GKE
We have to write a deployment /
service YAML files for K8 deployment.

© Copyright KodeKloud
Horizontal Pot
Autoscaling
Ingress Deployment
YAML
Service YAML

© Copyright KodeKloud
GitHub GKE
We have to setup CD to deploy this
code to GKE using the docker image
stored in artifactory.

© Copyright KodeKloud
GitHub GKE
Automated way to build the docker image.
We have to store the Docker image in an
artifactory.
We have to write a deployment/service
yamlfiles for K8 deployment.
We have to setup CD to deploy this code to
GKE using the docker image stored in
artifactory.

© Copyright KodeKloud
How do you research?

© Copyright KodeKloud
GCP Documentation
CI/CD Tool
Deploy GitHub Repository YAML Files
YAML
Answer
Research Open Source Read Code

© Copyright KodeKloud
GitHub GKE
Automated way to build the docker image.
We have to store the Docker image in an
artifactory.
We have to write a deployment/service
yamlfiles for K8 deployment.
We have to setup CD to deploy this code to
GKE using the docker image stored in
artifactory.

© Copyright KodeKloud
What tools in GCP can
help us achieve this ?

© Copyright KodeKloud
GitHub GKE
Automated way to build the docker image.
We have to store the Docker image in an
artifactory.
We have to write a deployment/service
yamlfiles for K8 deployment.
We have to setup CD to deploy this code to
GKE using the docker image stored in
artifactory.

© Copyright KodeKloud

© Copyright KodeKloud
Automated way to
build the docker image.
CD tool in GCP
Use it to build docker Image

© Copyright KodeKloud
We have to store the
Docker image in an
artifactory.
Store Docker Image

© Copyright KodeKloud
We have to write a
deployment/service
yamlfiles for K8
deployment.
Use it to deploy our
image to GKE cluster.

© Copyright KodeKloud
We have to setup CD to
deploy this code to
GKE using the docker
image stored in
artifactory.
Use it to deploy our
image to GKE cluster.

© Copyright KodeKloud
How does Cloud Build work?

© Copyright KodeKloud
How does GCP Artifactory work?

© Copyright KodeKloud
Services in GCP
Cloud Build
GCP Artifact Registry

© Copyright KodeKloud
Cloud
Build
GCP
Artifact
Registry
GitHub GKE
Cloud
Build
1
2
2
2
Build and store Docker Image1 Deploy Docker Image to GKE2
1

© Copyright KodeKloud
Sprint-03 review

© Copyright KodeKloud
Design Discussion on CI/CD
CI CD

© Copyright KodeKloud
What is Cloud Build in GCP?

© Copyright KodeKloud
What is GCP Artifact Registry?

© Copyright KodeKloud
What is GCP Artifact Registry?

© Copyright KodeKloud
Cloud
Build
GCP
Artifact
Registry

© Copyright KodeKloud

© Copyright KodeKloud
Sprint-04

© Copyright KodeKloud
Cloud Build

© Copyright KodeKloud
What are the features of Cloud Build?

© Copyright KodeKloud
?
Cloud Build GitHub Repository

© Copyright KodeKloud
Automate Docker Image
Build Process
GCP Artifact Registry

© Copyright KodeKloud
Sprint Goals
Understanding Cloud Build in details
How to connect Cloud Build to GitHub Repository?
Automate Docker Image build process

© Copyright KodeKloud
Cloud Build in detail

© Copyright KodeKloud

© Copyright KodeKloud
What are the features of Cloud Build?

© Copyright KodeKloud
What are the driving factors?

© Copyright KodeKloud
CICD
CICD
CICD
CICD
CI CD

© Copyright KodeKloud
Build software quickly across all programming
languages, including Java, Go, Node.js and more.

© Copyright KodeKloud
Choose from 15 machine types and run hundreds
of concurrent builds per pool.

© Copyright KodeKloud
Deploy across multiple environments such as
VMs, serverless, Kubernetes, or Firebase.

© Copyright KodeKloud
Access cloud-hosted, fully managed CI/CD
workflows within your private network.
CI CD

© Copyright KodeKloud
Keep your data at rest within a geographical
region or specific location with data residency.

© Copyright KodeKloud
Takeaways
YAML
It is a complete serverless CI/CD platform
No Infrastructure to maintain
Pricing: E2 –Medium serverless $0.003 per build/minute
Code: Written in YAML file

© Copyright KodeKloud
YAML

© Copyright KodeKloud
?
Cloud BuildGitHub Repository

© Copyright KodeKloud
When is Cloud Build triggered?

© Copyright KodeKloud
Cloud Build trigger

© Copyright KodeKloud
When is Cloud Build triggered?

© Copyright KodeKloud
Jenkins Webhooks GitHub

© Copyright KodeKloud
What events to be used to trigger?

© Copyright KodeKloud
How to trigger the Cloud Build?

© Copyright KodeKloud
GitHub Cloud BuildCloud Build Trigger

© Copyright KodeKloud
What is the trigger?

© Copyright KodeKloud

© Copyright KodeKloud

© Copyright KodeKloud
Any push on the
main/master branch will
trigger our Cloud Build

© Copyright KodeKloud
Cloudbuild.yamlfile shall contain
the CD code

© Copyright KodeKloud
Quick walkthrough

© Copyright KodeKloud
Recap
Make code changes
Commit the changes to GitHub
Open a pull request (PR)
Merge the PR to the main/master repo
Cloud Build is triggered
Cloud Build will store the Docker image
to the Artifact Registry
Cloud
Build
GCP
Artifact
Registry
GitHub

© Copyright KodeKloud
Sprint-04 review

© Copyright KodeKloud
Sprint Goals
Understand Cloud Build in detail
Learn to connect Cloud Build to GitHub repo
Automate Docker image build process

© Copyright KodeKloud

© Copyright KodeKloud
Sprint-05

© Copyright KodeKloud
Extending the CI/CD process to deploy our Docker image on a GKE cluster
CI/CD Docker Image GKE

© Copyright KodeKloud
When will it be completed?

© Copyright KodeKloud

© Copyright KodeKloud
Why is it so?

© Copyright KodeKloud
CI/CD Docker Image GKE

© Copyright KodeKloud

© Copyright KodeKloud
How to break the task?

© Copyright KodeKloud

© Copyright KodeKloud

© Copyright KodeKloud
Creating a namespace in our GKE cluster

© Copyright KodeKloud
Creating a deployment file

© Copyright KodeKloud
Updating the Cloud Build code for deployment

© Copyright KodeKloud
Validating the deployment

© Copyright KodeKloud
Creating a namespace in our GKE cluster
Creating a deployment file
Updating the Cloud Build code for deployment
Validating the deployment

© Copyright KodeKloud
Sprint-05 review

© Copyright KodeKloud
Extending the CI/CD process to deploy our Docker image on a GKE cluster
CI/CD Docker Image GKE

© Copyright KodeKloud
Sprint Goals
Creating a namespace in our GKE cluster
Creating a deployment file
Updating the Cloud Build code for deployment
Validating the deployment

© Copyright KodeKloud

© Copyright KodeKloud
Sprint-06

© Copyright KodeKloud
YAML
Extending our gke.yamlfile to also include
code to expose our application via an endpoint

© Copyright KodeKloud
What is this service called?

© Copyright KodeKloud
How to expose our application?

© Copyright KodeKloud
Sprint-06 review

© Copyright KodeKloud
YAML
Extending our gke.yamlfile to also include code to expose our application via an endpoint

© Copyright KodeKloud

© Copyright KodeKloud
Sprint-07

© Copyright KodeKloud

© Copyright KodeKloud
!

© Copyright KodeKloud

© Copyright KodeKloud
We are requested to setup a
development environment

© Copyright KodeKloud
How do we do that?

© Copyright KodeKloud
What is a development environment?

© Copyright KodeKloud
Application Development Development
Environment
Main Branch

© Copyright KodeKloud
How do we set it up?

© Copyright KodeKloud
Upgrade replicas
using the new flow

© Copyright KodeKloud

© Copyright KodeKloud
Deployment process using the Development Environment

© Copyright KodeKloud
Deployment process using the Development Environment
Application ProductionProduction
Environment

© Copyright KodeKloud
Sprint-07 review

© Copyright KodeKloud
Dev Ops
Deploy the changes to production
using the right DevOps lifecycle
Develop Test Deploy

© Copyright KodeKloud
Tags