MODULE 8
Blue Green deployment
1.Two Identical Environments:
•Blue-Green Deployments involve having two identical
environments for your software, typically named "blue" and "green".
2.Continuous Service:
•One environment (e.g., blue) is live and serving users, while the
other (green) is idle.
3.Deployment and Testing:
•The new version of the software is deployed to the idle environment
(green). It's thoroughly tested and validated.
4.Traffic Switching:
•Once the new version is confirmed to be working correctly, user
traffic is gradually or immediately switched from the live
•environment (blue) to the new environment (green).
5.Rollback Capability:
•If issues arise with the new version, traffic can be quickly switched
back to the old environment (blue), minimizing downtime and user
impact.
Benefits Blue Green Deployment
It allow for updates and
changes to be made without
interrupting the service. This
1. Less Downtime: 2. Safety First:
means minimal downtime for
users, ensuring continuous
availability.
It provide a safe environment
to test new releases. By
deploying the new version to If any issues arise with the
a separate environment, any new deployment, it's easy to
issues or bugs can be roll back to the previous,
identified and addressed 3. More Reliable: stable version. This quick
without affecting the live rollback capability ensures
service. This reduces the risk reliability and minimizes the
of unexpected problems and impact of any problems.
ensures a smoother
deployment process.
Implementation Blue Green
Deployment
2.Execute the
Create and Save the
Deployment:Use the kubectl
Deployment File:Create a
apply command to apply the
YAML file named Blue-
configuration specified in the
deployment.yml.This file
Blue-deployment.yml file to
defines the desired state of
the Kubernetes cluster.The
your application, including
kubectl rollout status
the number of replicas,
command monitors the
resource limits, and other
deployment process and
deployment specifications.
reports on its status.
Implementation Blue
Green Deployment
•1. Create and Save the App Load-Balancer File:
•Create a YAML file named production-service.yml.
•This file defines the desired state of your application's load balancer, including
the service name, port, and other configuration details.
•2. Execute the Deployment of the Production Service:
•Use the kubectl apply command to apply the configuration specified in the
production-service.yml file to the Kubernetes cluster.
•This will create the load balancer and route traffic to the specified deployment.
Command:
•Bash
•kubectl apply -f production-service.yml
•3. Traffic Routing:
•By default, the newly created load balancer will route traffic to the latest
deployment, which is the v1.0 (blue) deployment in this case.
Implementation Blue Green Deployment
1. Conduct Tests on the Green Instance:
•After deploying the new version (v1.1) to the green environment, thorough testing is conducted to ensure it functions as
expected.
•This includes unit tests, integration tests, and potentially user acceptance testing.
2. Potential Issue Handling:
•If issues are discovered during testing, the deployment of the new version (v1.1) is removed or deleted using the following
Command:
Bash
kubectl delete -f version2-deployment.yml
•The underlying code issues are addressed and fixed.
•Once the fixes are implemented, the deployment process is repeated to deploy the corrected version to the green environment.
3. Successful Deployment and Traffic Switching:
•If the testing of the new version (v1.1) is successful and deemed production-ready, the service is updated to direct traffic
to the green instance. This is achieved using the following command:
Bash
kubectl patch service production-service --patch '{"spec": {"selector": {"version": "v1.1"}}}'
•This command updates the service's selector to match the labels of the new version's pods,
effectively routing traffic to the green environment.
Drawbacks Blue Green Deployment
1. Potential Rise in Infrastructure Expenses:
•Explanation: Blue-Green deployments require maintaining two identical environments
simultaneously. It can lead to increased infrastructure costs due to the duplication of
resources.
2. Less Ideal for Minor Version Updates:
•Explanation: For minor version updates, the overhead of maintaining two environments
might outweigh the benefits of zero-downtime deployments.
3. Requires Rigorous Testing and Monitoring:
•Explanation: The green environment needs to be thoroughly tested and monitored before
traffic is switched to ensure a smooth transition. Any issues in the new version could lead to
service disruptions.
Advantage Canary Releasing
1. Risk Mitigation:
Explanation: Canary releases allow for risk mitigation by exposing the new version to a limited audience initially. If issues arise, they
impact only a small subset of users, minimizing the overall risk.
2. Early Issue Detection:
Explanation: By closely monitoring the canary group, any issues or bugs in the new release can be detected early in the deployment
process. This enables quick resolution before a full-scale release.
3. User Feedback Incorporation:
Explanation: Developers can gather valuable feedback from the canary group, incorporating user insights and making necessary
improvements before a broader release. This leads to a better user experience and higher user satisfaction.
4. Enhanced Reliability:
Explanation: Canary releases contribute to overall system reliability by ensuring that major issues are identified and addressed before
affecting the entire user base. This helps maintain system stability and reduce the likelihood of service disruptions.
•1.Feature Rollouts:
•Explanation: Feature rollouts involve gradually introducing new
features to a subset of users to assess user response and identify any
unforeseen issues. This helps mitigate risks and gather valuable user
feedback.
•2.A/B Testing:
•Conducting A/B tests with different versions of a feature allows
developers to evaluate user preferences and optimize the feature's
Uses Cases
design and functionality.
•3.Software Updates:
•Explanation: Software updates are typically deployed incrementally
Canary
to minimize the impact of potential bugs or compatibility issues. This
approach allows for a controlled rollout and quick identification of any
deployment-related problems.
•4.Staged Deployments:
Releasing •Releasing updates in stages, such as canary releases or blue-green
deployments, helps ensure a smooth and controlled rollout. This
approach reduces the risk of widespread failures and allows for rapid
rollback if necessary.
•5.Performance Testing:
•Explanation: Performance testing involves evaluating the
performance of a new release in a real-world environment before a full-
scale deployment. This helps identify and address any performance
bottlenecks or issues that may arise.
Case Study: Google Canary Release
Company Background
Google LLC:
•A multinational technology company specializing in Internet-related
services and products.
Google Chrome:
•A widely used web browser known for its speed, simplicity, and
efficiency.
•Regularly receives updates to improve functionality and security.
Google's Approach:
•Google has a forward-thinking approach to technology and innovation.
•This is evident in its development strategies for Chrome, including the
Canary release.
Case Study: Google Canary Release
Static Code Analysis in Canary:
•Early Issue Detection: Canary utilizes advanced static code analysis tools to proactively
identify potential coding issues, bugs, and vulnerabilities in the codebase. This early
detection allows for timely fixes and prevents issues from propagating into later
development stages.
•Continuous Integration Integration: These static code analysis tools are seamlessly
integrated into Google's continuous integration pipeline. This means that whenever code is
committed to the repository, it undergoes automatic analysis, providing immediate
feedback to developers about any potential problems.
•Real-World Testing: Developers are encouraged to use Canary to test their code in a real-
world environment. This complements the results of static code analysis by identifying
issues that might not be detectable through static analysis alone.
Case Study: Google Canary Release
Challenges:
1.High Frequency of Updates:
1. With daily updates, maintaining stability while introducing new features is challenging.
2.Complex Code Base:
1. Chrome's extensive and complex codebase can make static analysis resource-intensive.
Solutions:
3.Automated Testing and Rollback Mechanisms:
1. Canary employs automated testing and rollback mechanisms to address issues as soon as they arise.
This helps maintain stability and quickly fix any problems introduced by new updates.
4.Efficient, Scalable Static Analysis Tools and Parallel Processing:
1. Implementing efficient, scalable static analysis tools and parallel processing techniques helps manage
the complexity of the codebase and improve the performance of static analysis.
Case Study: Google Canary Release
Outcomes
1. Early Bug Detection and Resolution:
•Many bugs and issues are identified and fixed before reaching the Beta or Stable versions of Chrome.
•This ensures a higher quality product for majority of users.
2. Accelerated Feature Development and Deployment:
•Canary allows Google to test and iterate new features quickly.
•This leads to faster rollouts of new features in the stable Chrome version, keeping users up-to-date with the latest
advancements.
3. Enhanced Security:
•Continuous static code analysis helps in identifying and fixing security vulnerabilities early.
•This helps prevent potential security breaches and makes Chrome a more secure browser.
4. Community Engagement and Feedback:
•Canary has fostered a community of early adopters and developers who provide valuable feedback.
•This community engagement helps improve the overall quality of Chrome by incorporating user insights and
suggestions.
5. Risk Mitigation:
•By testing changes in Canary first, Google mitigates the risk of introducing major issues in the more widely-used
versions of Chrome.
•This ensures a smoother and more stable release process.
•A/B testing, also known as split testing, is a method
of comparing two versions (A and B) of a webpage,
app, email, or other digital asset to determine which
one performs better.
•Key Points:
•Comparison of Two Versions: A/B testing
involves creating two versions of a digital asset, A
A/B and B, with slight variations in design, content, or
layout.
•Performance Measurement: Both versions are
Testing presented to different segments of users, and their
performance is tracked and measured.
•Identifying Better Performance: The goal is to
identify which version performs better in terms of
specific metrics, such as clicks, conversions, or user
engagement.
•Data-Driven Decision Making: By analyzing the
results of the A/B test, you can make data-driven
decisions to optimize your digital assets and
improve their effectiveness.
Roles A/B Testing during Deployment
Validating changes User Experience Risk Mitigation Data Driven
Optimization Decision Making
A/B testing allow It help optimize the A/B testing By collecting &
for the validation of user experience by provides a analyzing user
new features or testing variations controlled behavior data
changes by in environment to during A/B
comparing user design,functionality assess impact of tests,teams can
experiences b/w ,or content. Its data changes on a make informed
two versions ( A driven approach subset of users. If decisions about
&B) ensures that the issues arise, they which version
It ensures that deployed version can be identified performs better &
deployment meets resonates better early, minimizing aligns more closely
user expectations & with users. risk of with the desired
performs as outcomes
intended.
Setting Up Effective Monitoring For
Informed Decision-making
1. Define Objectives and Key Performance Indicators (KPIs):
•Clearly articulate objectives and goals: Start by defining the specific goals you want to achieve through
monitoring.
•Identify relevant KPIs: Choose KPIs that align with your objectives and are measurable, achievable, relevant, and
time-bound (SMART). KPIs, help you track progress and measure the impact of your actions.
2. Select Appropriate Tools and Technology:
•Choose suitable tools: Select monitoring tools that match your specific needs. This could include project
management software, analytics platforms, or specialized monitoring tools.
•Ensure data collection and analysis: Ensure that the chosen tools can collect and analyze data in real-time or at
regular intervals to provide timely insights.
3. Establish Baselines:
•Set baseline metrics: Establish baseline performance metrics before implementing any changes or improvements.
•Measure impact: Use these baseline metrics as a reference point to measure the impact of your actions and
interventions.
Setting Up Effective Monitoring For
Informed Decision-Making
1. Set Thresholds and Alerts:
•Define acceptable ranges: Establish clear performance thresholds for key metrics.
•Trigger alerts: When performance deviates beyond these thresholds, set up automated alerts to notify relevant teams.
This proactive approach allows for timely responses to potential issues.
2. Automate Data Collection:
•Automate data collection: Whenever possible, automate the process of collecting relevant data to ensure accuracy and
timeliness.
•Reduce manual errors and free up resources: Automation reduces the risk of human error and frees up resources for
more strategic tasks.
3. Implement Real-Time Monitoring:
•Enable real-time monitoring: Real-time monitoring allows you to respond promptly to emerging issues or
opportunities.
•Dynamic environments: This is especially critical in dynamic environments where conditions can change rapidly.
4. Create Dashboards and Reports:
•Develop user-friendly dashboards and reports: Create clear and easy-to-understand visualizations of key metrics.
•Enable quick insights: It enables stakeholders to quickly grasp the current status and identify trends.
Setting Up Effective Monitoring For
Informed Decision-Making
1. Ensure Data Quality:
•Regularly audit and validate data: Ensure the accuracy and reliability of your data by regularly
auditing and validating it. Inaccurate data can lead to incorrect assessments and decision-making.
2. Encourage Cross-Functional Collaboration:
•Foster collaboration: Share relevant monitoring data with different departments or teams to promote
collaboration and a holistic understanding of the organization's performance. This helps break down silos
and encourages a unified approach to improvement.
3. Regularly Review and Update:
•Periodically review the monitoring system: Regularly review your monitoring system to ensure its
relevance and effectiveness.
•Update KPIs, thresholds, and processes: Update KPIs, thresholds, and processes as needed to align
with evolving organizational priorities and external factors.
4. Comply with Regulations and Policies:
•Ensure compliance: Ensure that your monitoring practices comply with relevant regulations and
internal policies, especially concerning data privacy and security.
•1. Train and Educate Users:
•Provide training: Ensure that users are
Setting Up trained on how to interpret monitoring data
effectively.
Effective •Understand the significance of metrics: Key
stakeholders should understand the
Monitorin significance of the metrics being monitored
to make informed decisions.
g For •2. Feedback Mechanism:
•Establish a feedback loop: Implement a
Informed feedback mechanism that allows
stakeholders to provide input on the
Decision- monitoring system.
•Refine and improve: This feedback helps in
Making refining and improving the monitoring
system over time, ensuring it meets the
evolving needs of the organization.
• GitHub Actions Workflow
• Jenkins job
Perfecting
Deployment
Implementa
tion
blue/green
• GitHub actions workflow
• Jenkins job(for triggering canary
Utilizing deployment)
• Jenkins job(test & publish new version)
Jenkins
And
GitHub
Actions For
Streamline
d Canary
Version control Pipeline as code: Secrets
integration: management:
Use Jenkins file
Integrate Jenkins for defining your Use Jenkins
with version pipeline as code. credentials or
control system & It allow secret for
configure triggers versioning code sensitive
for code change review, better information like
Tips For Setting Up collaboration docker registry
& Troubleshooting credentials.
Common Issues Avoid hardcoding
secrets in
pipeline script
Artifact Pipeline Parallel execution:
management: visualization:
For faster build,
If application Leverage blue consider
produces ocean plugin or parallelizing task or
artifacts,consider traditional Jenkins stage in your
using an artifact UI to visualize & pipeline when
Check Jenkins Logs: Pipeline Syntax Check: Environment
Variables:
Examine Jenkins Logs Use Pipeline Syntax Tool I
For Error Warning. Jenkins To Validate Verify That
Navigate To Pipeline Syntax Before Environment
Jenkins>manage Running Job Variables,
Jenkins>system Log Especially Those
Tips For Setting Up & Detail Information Related To Docker
Troubleshooting Credentials &
Common Issues Registry
Information Are
Correctly Defined In
Jenkins Job
Docker permissions: Agent configuration: Docker image pull:
Ensure Jenkins user Confirm your pipeline The pipeline
has necessary agent configuration is involves pulling
permission to interact appropriate for your use docker images are
with docker. case available in the
It might require specified registry &
adding Jenkins user to that the registry
docker group or credentials are
configure docker correctly configured
credentials in Jenkins
Tips For Setting Up
& Troubleshooting Artifacts paths: Test failures: Pipeline visualization:
Common Issues
Verify that artifact If test fail, check test Use pipeline
path are correctly output in Jenkins. visualization tools to
specified in pipeline Ensure test identify stage at
& necessary artifacts environment within which the pipeline
are produced during your docker container fail.
build. is set up correctly. It can help narrow
down the issue.
Incremental Documentation & Community &
Debugging: Comments: Documentation:
Keep your pipeline Leverage online
Temporary add script well forums, Jenkins
debugging statement documented. Include community channels
or print statement in comments explaining & official
pipeline script to each stage & critical documentation.
understand flow & configuration settings Many Jenkins users
identify point of to aid share experiences &
failure troubleshooting. solution for common
issues
THANK
YOU