Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From Infrastructure as Code to Environment as Code – DevOps Days Poznań

From Infrastructure as Code to Environment as Code – DevOps Days Poznań

Infrastructure as Code has made managing infrastructure easier in a lot of ways, but there are many challenges that companies accept as the cost of adopting IaC especially when scaling. This talk digs into these challenges & introduces Environment as Code that helps resolve those challenges.

Adarsh Shah

October 05, 2021
Tweet

More Decks by Adarsh Shah

Other Decks in Technology

Transcript

  1. From Infrastructure as
    Code to Environment as
    Code
    Challenges scaling IaC
    and how to resolve them
    Adarsh Sha
    h

    Engineering Leader, Coach, Public Speake
    r

    Founder & CEO at CompuZes
    t

    @shahadarsh 

    https://compuzest.com
    https://bit.ly/eac-poznan @shahadarsh

    View full-size slide

  2. https://bit.ly/eac-poznan @shahadarsh
    Infrastructure as Code
    Infrastructure as Code (IaC) is an approach that takes
    proven coding techniques used by software systems and
    extends it to infrastructure. It is one of the key DevOps
    practices that enable teams to deliver infrastructure,
    and thereby software running on it, rapidly and
    reliably.

    View full-size slide

  3. https://bit.ly/eac-poznan @shahadarsh
    Evolution of IaC Setup
    networkin
    g

    +

    platform-ec
    2

    +

    s3-bucket
    Monolith Ia
    C

    with a Single Run
    networking
    platform-k8s
    k8s-addons
    postgres
    networking
    k8s-addons
    networkin
    g

    +

    platform-ec
    2

    +

    s3-bucket platform-ec2
    platform-k8s postgres
    platform-ec2
    Breaking into Separate & Smaller IaC Runs

    View full-size slide

  4. https://bit.ly/eac-poznan @shahadarsh
    Evolution of IaC Execution
    From Engineers


    machine
    IaC Pipeline/GitOps execution


    from a Shared Environment

    View full-size slide

  5. @shahadarsh
    https://bit.ly/eac-poznan

    View full-size slide

  6. https://bit.ly/eac-poznan @shahadarsh
    • Option
    1

    • Create a Monolith Ia
    C

    • Option
    2

    • Hand-roll Pipelines


    • Manage Complex Dependencies
    Options for Entire Environment Provisioning

    View full-size slide

  7. https://bit.ly/eac-poznan @shahadarsh
    Other Challenges scaling IaC
    Replicating Environments


    is a pain
    Not easy to visualize/understand


    Environments
    Drift Detection

    View full-size slide

  8. @shahadarsh
    https://bit.ly/eac-poznan
    What is Environment as
    Code?

    View full-size slide

  9. https://bit.ly/eac-poznan @shahadarsh
    Environment as Code
    networking
    platform-k8s
    k8s-addons
    postgres
    networking
    k8s-addons
    platform-k8s postgres
    Declarative
    Environment as Code

    View full-size slide

  10. https://bit.ly/eac-poznan @shahadarsh
    IaC vs EaC
    Infrastructure as Code
    Automates various Lego Pieces 

    (i.e. Infrastructure Resources)
    Environment as Code
    Automates how those Lego Pieces 

    are connected to make up a Lego Toy 

    (i.e. Entire Environment)

    View full-size slide

  11. https://bit.ly/eac-poznan @shahadarsh
    Environment as Code
    Environment as Code (EaC) is an abstraction over
    Infrastructure as Code that provides a declarative way of
    de
    fi
    ning an entire Environment. It has a Control Plane that
    manages the state of the environment, including
    relationships between various resources, Detects Drift as well
    enables Reconciliation. It also supports best practices like
    Loose Coupling, Idempotency, Immutability, etc. for the entire
    environment. EaC allows teams to deliver entire environments
    rapidly and reliably, at scale.

    View full-size slide

  12. @shahadarsh
    https://bit.ly/eac-poznan
    Provision Environment
    Environment as Code
    Environment
    State
    (Manages dependencies,


    status etc. )
    State
    networking
    platform-k8s
    State
    k8s-addons
    State
    postgres
    State
    networking
    k8s-addons
    platform-k8s postgres
    Provision
    Control Plane
    Reconcile
    Declarative
    Detect Drift

    View full-size slide

  13. @shahadarsh
    https://bit.ly/eac-poznan
    Teardown Environment
    Environment as Code
    State
    State
    State
    State
    Teardown
    Declarative
    networking
    platform-k8s
    k8s-addons
    postgres
    k8s-addons
    networking
    Control Plane
    postgres
    platform-k8s
    Reconcile
    Detect Drift
    Environment
    State
    (Manages dependencies,


    status etc. )

    View full-size slide

  14. @shahadarsh
    https://bit.ly/eac-poznan
    Attributes of Environment as
    Code

    View full-size slide

  15. https://bit.ly/eac-poznan @shahadarsh
    Ability to de
    fi
    ne Entire Environment
    Example Environment as Code

    View full-size slide

  16. @shahadarsh
    https://bit.ly/eac-poznan
    Environment as Code
    networking
    platform-k8s
    k8s-addons
    postgres
    networking
    platform-k8s
    k8s-addons
    postgres
    Declarative
    Loosely Coupled

    View full-size slide

  17. @shahadarsh
    https://bit.ly/eac-poznan
    Manage State for the entire Environment
    Example Environment State File

    View full-size slide

  18. @shahadarsh
    https://bit.ly/eac-poznan
    Idempotent and Immutable for
    entire Environment

    View full-size slide

  19. https://bit.ly/eac-poznan @shahadarsh
    Non-Idempotent
    Provision
    VM VM VM
    { }
    IaC
    3 VMs
    End State

    Expected =
    3

    Actual = 6
    Idempotent
    End State

    Expected =
    3

    Actual = 3
    Reapply
    VM VM VM
    Provision
    VM VM VM
    Reapply
    No change
    { }
    IaC
    3 VMs

    View full-size slide

  20. https://bit.ly/eac-poznan @shahadarsh
    Provision
    v1 v1 v1
    User
    Mutable Infrastructure
    { }
    IaC
    Apply
    changes
    v2
    v2 v2
    Change
    { }
    IaC
    v1 v1 v1
    Provision
    User
    Provision
    v2 v2 v2
    User
    Immutable Infrastructure
    { }
    IaC
    Change
    { }
    IaC
    Deploys v2 to same Infrastructure Provisions new Infrastructure with v2

    View full-size slide

  21. https://bit.ly/eac-poznan @shahadarsh
    Visualize and Understand Environments

    View full-size slide

  22. https://bit.ly/eac-poznan @shahadarsh
    Drift Detection and Reconciliation
    Reconcil
    e

    (Preferably with Approval)
    Desired State Current State
    Control Loop
    Observe/Detect Drift

    View full-size slide

  23. https://bit.ly/eac-poznan @shahadarsh
    Compare and Promote Changes between
    Environments
    Compare & promote changes


    across environments
    GitOps for Entire Environment

    View full-size slide

  24. @shahadarsh
    https://bit.ly/eac-poznan
    Create Pull Request
    ,

    EaC Validate
    Validate
    Approve & 

    Merge PR
    Control
    Plane
    Reconcile
    GitOps for Environment
    EaC
    Trunk
    networking
    platform-k8s
    k8s-addons
    postgres
    Observe
    Branch
    networking
    platform-k8s
    k8s-addons
    postgres

    View full-size slide

  25. https://bit.ly/eac-poznan @shahadarsh
    Attributes of EaC
    • Ability to de
    fi
    ne Entire Environmen
    t

    • Loosely Coupled


    • Manage State for the entire Environmen
    t

    • Idempotent and Immutable for entire Environmen
    t

    • Visualize and Understand Environment
    s

    • Drift Detection and Reconciliatio
    n

    • Compare and Promote Changes between Environments

    View full-size slide

  26. Adarsh Sha
    h

    Engineering Leader, Coach, Public Speake
    r

    Founder & CEO at CompuZes
    t

    @shahadarsh 

    https://compuzest.com
    Thank You
    https://bit.ly/eac-poznan @shahadarsh

    View full-size slide