> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Release Engineering Best Practices

> Practical release engineering best practices to enable safe, automated, and observable deployments using progressive delivery, artifact management, CI/CD, secrets rotation, rollback testing, and continuous communication

In this final lesson we bring together the concepts from the module to describe practical, repeatable patterns for safe releases. Release engineering’s objective is simple: enable change, and make change safe. It sits at the intersection of development speed, operational safety, and executive patience—helping teams deliver features quickly without increasing risk.

A sobering statistic to keep in mind: roughly 70% of outages are caused by changes. Release engineering reduces that risk by making changes predictable, observable, and reversible. The best compliment is that releases are so uneventful nobody notices them.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/release-engineering-sre-safe-boring-releases.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=5de4dbffc4db0c1cf426ca0909f8b985" alt="A presentation slide titled &#x22;Release Engineering for SRE&#x22; with a Venn diagram showing Development Speed, Operational Safety, and Executive Patience overlapping to produce &#x22;Safe Releases.&#x22; Bulleted points state &#x22;70% of outages caused by changes,&#x22; define release engineering as making change safe, and set the goal as &#x22;boring releases.&#x22;" width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/release-engineering-sre-safe-boring-releases.jpg" />
</Frame>

## Core principles of safe release engineering

* Automate everything. Any manual step is a future outage vector.
* Use progressive delivery. Validate changes with a small percentage of traffic (e.g., 1%) before full rollout.
* Practice fast, tested rollbacks. If rollback is slower than deployment, the rollback process needs improvement.
* Always verify deployments with smoke tests to get quick feedback.
* Communicate relentlessly—silent deployments tend to become noisy incidents.

<Callout icon="lightbulb" color="#1CB2FE">
  Apply automation to policy, approvals, and rollbacks. Automated “safety nets” (canaries, health checks, automatic rollbacks) let you move fast with confidence.
</Callout>

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/core-principles-kodekloud-slide.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=45d1c6cc2d8958bc31b8126b185488af" alt="A presentation slide titled &#x22;Core Principles&#x22; showing five rounded-card principles—Automate everything; Progressive delivery; Easy, tested rollbacks; Always verify; and Communicate relentlessly—each with a short explanatory note. The slide is copyrighted by KodeKloud." width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/core-principles-kodekloud-slide.jpg" />
</Frame>

## Deployment strategies — choose the right approach

Each strategy has trade-offs. Select the approach that matches your risk tolerance, infrastructure costs, and rollback needs.

| Strategy        | Pattern                                                | When to use                                            | Pros                                                       | Cons                                      |
| --------------- | ------------------------------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------- | ----------------------------------------- |
| Blue–Green      | Maintain two identical environments and switch traffic | Critical systems needing near-zero error exposure      | Instant cutover; straightforward rollback                  | Requires duplicate infrastructure         |
| Canary          | Gradual rollout to a small subset of users             | User-facing features and metrics-driven validation     | Limits blast radius; observable behavior on real traffic   | Needs good traffic routing/metrics        |
| Feature flags   | Ship code behind toggles                               | A/B testing, incremental launches, operational control | Turn features on/off without deploys; reduces release risk | Technical debt from stale flags           |
| Rolling updates | Replace instances in small batches                     | Stateless services or safe stateful upgrades           | No duplicate infra required; steady migration              | Coordination needed for DB/schema changes |

Common guidance:

* Blue–Green is best when you can afford duplicate environments and need instant rollback.
* Canary deployments require solid monitoring and automated health gates.
* Feature flags decouple deployment and release — remove flags when stable.
* Rolling updates work well when instances are independent and stateless.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/deployment-strategies-comparison-table.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=839a5566fe8856d62846d8f8c116d478" alt="A slide titled &#x22;Deployment Strategies&#x22; showing a comparison table of Blue/Green, Canary, Feature Flags, and Rolling deployments with rows for approach, best-for, examples, and cautions." width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/deployment-strategies-comparison-table.jpg" />
</Frame>

## Artifact repository management

Artifact repositories are the core of a trustworthy software supply chain. They store Docker images, packages, and binaries and provide the guarantees needed for safe, auditable releases.

Why they matter for SREs:

* Security: control what is deployable.
* Compliance: retain audit trails for every version.
* Performance: accelerate retrieval and reduce network variability.
* Disaster recovery: immutable artifacts enable rollbacks and re-deployments.

Best practices:

* Use enterprise registries for production (AWS ECR, Google Artifact Registry) instead of public registries for critical systems.
* Enforce lifecycle policies to limit storage while keeping recovery points.
* Apply strict access control: automation writes, humans read or approve where necessary.
* Make production images immutable and block overwrites.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/artifact-repo-sre-security-performance-recovery.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=06dddecd3f26484d48a44595595486de" alt="A presentation slide titled &#x22;Artifact Repository Management&#x22; explaining why it matters for SREs, with four colored boxes: Security, Compliance, Performance, and Disaster Recovery. Each box notes a key goal: control deployments, maintain audit trails, ensure fast/reliable retrieval, and keep immutable backups of deployments." width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/artifact-repo-sre-security-performance-recovery.jpg" />
</Frame>

Public registries such as Docker Hub are convenient but subject to rate limits, retention policies, and varying security guarantees. For production, prefer cloud registries where you can apply lifecycle and access policies.

Example: create an ECR repository and apply a lifecycle policy to keep only the last 10 production images.

```bash theme={null}
# Create the repository
aws ecr create-repository --repository-name kodekloud/records-api
```

Save the lifecycle policy as policy.json:

```json theme={null}
{
  "rules": [
    {
      "rulePriority": 1,
      "description": "Keep last 10 production images",
      "selection": {
        "tagStatus": "tagged",
        "tagPrefixList": ["prod-"],
        "countType": "imageCountMoreThan",
        "countNumber": 10
      },
      "action": {
        "type": "expire"
      }
    }
  ]
}
```

Apply the policy:

```bash theme={null}
aws ecr put-lifecycle-policy --repository-name kodekloud/records-api --lifecycle-policy-text file://policy.json
```

Example repository access model:

```yaml theme={null}
repositories:
  production:
    read: [sre-team, deploy-service]
    write: [release-automation]
    admin: [platform-team]

  staging:
    read: [developers, qa-team]
    write: [ci-system, developers]
    admin: [team-leads]
```

Environment-specific registry settings:

```yaml theme={null}
environments:
  development:
    docker_registry: "dev-registry.kodekloud.internal"
    package_repo: "https://packages-dev.kodekloud.internal"
    retention: "7 days"
    vulnerability_scan: "advisory"

  staging:
    docker_registry: "staging-registry.kodekloud.internal"
    package_repo: "https://packages-staging.kodekloud.internal"
    retention: "30 days"
    vulnerability_scan: "blocking"

  production:
    docker_registry: "prod-registry.kodekloud.internal"
    package_repo: "https://packages-prod.kodekloud.internal"
    retention: "1 year"
    vulnerability_scan: "blocking + attestation"
    immutable: true  # Prevent overwriting tags
```

## CI/CD pipeline best practices

A robust pipeline automates build, test, security, deployment, verification, and monitoring. Key elements:

* Build artifacts in a reproducible, hermetic environment.
* Run unit, integration, and end-to-end tests before artifacts are promoted.
* Run security and vulnerability scans early (shift-left).
* Deploy to staging with automated integration tests and performance checks.
* Require explicit approvals for risky production changes (policy as code).
* Perform health checks and automated rollbacks on failure.

A healthy pipeline sequence:
Build → Test → Security scan → Deploy to staging → Integration tests → Deploy to production → Health check → Monitor

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/cicd-pipeline-best-practices.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=6d1ac3225cd74254a647414a012e6da9" alt="The image is a slide titled &#x22;CI/CD Pipeline Best Practices&#x22; showing a circular workflow. It diagrams stages: Build → Test → Security scan → Deploy to staging → Integration tests → Deploy to production → Health check → Monitor." width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/cicd-pipeline-best-practices.jpg" />
</Frame>

## Secrets management

Secrets and credential leaks are a common source of incidents. Follow these rules:

* Never hard-code secrets in source code or config files.
* Centralize secrets in a dedicated secrets manager (HashiCorp Vault, AWS Secrets Manager, etc.).
* Use short-lived, revocable credentials and automate secret rotation.
* Monitor for leaked secrets and automate incident response.

<Callout icon="warning" color="#FF6B6B">
  Never commit credentials or long-lived keys to source control. Assume secrets will leak and design for short-lived, revocable credentials plus automated rotation and monitoring.
</Callout>

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/ci-cd-secrets-best-practices.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=b2da02d09cce3d40cf7764af19ff95e0" alt="A slide titled &#x22;CI/CD Pipeline Best Practices&#x22; listing four tips: 01 Never hardcode secrets, 02 Use secret management tools, 03 Rotate secrets regularly, and 04 Monitor for secret leaks." width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/ci-cd-secrets-best-practices.jpg" />
</Frame>

## Communication and continuous learning

Release engineering is as much about people and process as it is about tools.

* Before release: Notify stakeholders, prepare the support rota, and document rollback and mitigation plans.
* During release: Publish real-time updates and decide Go/No-Go using metrics (error rate, latency, saturation) rather than intuition.
* After release: Compare outcomes to success criteria, run blameless postmortems on failures, and update runbooks and automation.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/CPMhbBdnQZODfG85/images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/communication-learning-release-stages-checklist.jpg?fit=max&auto=format&n=CPMhbBdnQZODfG85&q=85&s=6d14331e37de0bc474daab7b0310f777" alt="A slide titled &#x22;Communication and Learning&#x22; showing three connected stages—Before Release, During Release, and After Release. Each stage has checklist bullets (e.g., stakeholders notified, rollback plan and support ready; real-time updates and metric-based Go/No-Go; success metrics, blameless post-mortem, and docs/process updates)." width="1920" height="1080" data-path="images/Fundamentals-of-SRE/Release-Engineering/Release-Engineering-Best-Practices/communication-learning-release-stages-checklist.jpg" />
</Frame>

## Wrap-up

This lesson covered the operational patterns, technical controls, and organizational practices that make change safe and predictable:

* Automation and policy-as-code
* Progressive delivery (canaries, feature flags)
* Fast, tested rollback processes
* Artifact repository management with lifecycle and access controls
* Secure CI/CD pipelines with shift-left security
* Secrets management with rotation and monitoring
* Continuous communication and blameless learning

The next hands-on topic dives into observability—logs, metrics, traces, dashboards, and alerting—where release engineering and SRE work together to ensure releases behave as expected in production.

## Links and references

* [Kubernetes Documentation](https://kubernetes.io/docs/)
* [Docker Hub](https://hub.docker.com/)
* [AWS Elastic Container Registry (ECR)](https://aws.amazon.com/ecr/)
* [Google Artifact Registry](https://cloud.google.com/artifact-registry)
* [HashiCorp Vault](https://www.vaultproject.io/)
* [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/fundamentals-of-sre/module/b1ba0f45-8f39-445f-bc44-5d77d3a56b1c/lesson/5c7b8c62-d391-4230-b4ac-9417a91e5760" />

  <Card title="Practice Lab" icon="flask-conical" cta="Learn more" href="https://learn.kodekloud.com/user/courses/fundamentals-of-sre/module/b1ba0f45-8f39-445f-bc44-5d77d3a56b1c/lesson/d6970a1f-f93f-4d6c-9ff3-8738274e912e" />
</CardGroup>
