SlideShare a Scribd company logo
1 of 42
Download to read offline
Copyright © 2021 HashiCorp
GitOps & Continuous
Infrastructure with Terra*
Haggai Philip Zagury, DevOps Group & Tech lead
September 2021
Focus for today's talk - why GitOps
GitOps
Every Change is Driven by a change in source control
Focus for today's talk - why GitOps
GitOps
Every Change is Driven by a change in source
control
Alexis Richardson coined the term Gitops in
2017. Gitops is the new phase of DevOps
that many organizations are adopting, in
which all the infrastructure will be stored in
Git as code and will be used for continuous
deployment
#1 - The entire system described declaratively.
#2 - The canonical desired system state versioned in Git.
#3 - Approved changes that can be automatically applied to the
system.
------
#4 - Software agents to ensure correctness and alert on
divergence.
My Journey.tf
Using terraform in various use cases, adv, caveats
Working with terraform for the past 5 years (at least)
Love & Hate relationship with State management
- From tiny projects (single main.tf file)
My Journey.tf
Using terraform in various use cases, adv, caveats
Working with terraform for the past 5 years (at least)
Love & Hate relationship with State management
- From tiny projects (single main.tf file)
- To 10’s of *.tf files
- Have you seen 001_s3.tf, 002_iam.tf …
- Things can break very fast ....
My Journey.tf
Using terraform in various use cases, adv, caveats
Working with terraform for the past 5 years (at least)
Love & Hate relationship with State management
- From tiny projects (single main.tf file)
- To 10’s of *.tf files
- Upgrading to terraform 0.13
- What comes first ? Account / S3 / Dynamodb lock table ?
- Terraform without terraform cloud ?!
(for small teams / startups)
My Journey.tf
Using terraform in various use cases, adv, caveats
Working with terraform for the past 5 years (at least)
Love & Hate relationship with State management
- From tiny projects (single main.tf file)
- To 10’s of *.tf files
- Upgrading to terraform 0.13
- What comes first ? Account / S3 / Dynamodb lock table ?
- Terraform without terraform cloud ?!
(for small teams / startups)
- Seamless integration with Consul / Vault (more on that later)
The ones I worked with ;)
My Journey.tf
Using terraform in various use cases, adv, caveats
Working with terraform for the past 5 years (at least)
Love & Hate relationship with State management
- From tiny projects (single main.tf file)
- To 10’s of *.tf files
- Upgrading to terraform 0.13
- What comes first ? Account / S3 / Dynamodb lock table ?
- Terraform without terraform cloud ?!
(for small teams / startups)
- Seamless integration with Consul / Vault (more on that later)
- Cloud Native Technologies
My Journey.tf
For a while my life was waiting for these ...
My Journey.tf
For a while my life was waiting for these ...
My Journy.tf
Life getting D.R.Yer
Focus for today's talk
GitOps
Every Change is Driven by a change in source
control (git is standard scm hence GitOps)
Continuous Infrastructure &
Operations
Utilizing DevOps best-practices and tools
enabling and entire SDLC based on Git
Operations.
01 Terraform introduction
01 GitOps the early days ...
Terraform Cloud
01 GitOps the early days ...
Terraform Cloud || Run from your laptop
01 GitOps the early days ...
Terraform Cloud || Run from your laptop
CODE EDITOR
dev-mode
#!/bin/bash
__git_check_if_changed() {
git diff --name-only --quiet HEAD^..HEAD -- $1
echo $?
}
export CHANGED_FRONTEND=$(__git_check_if_changed ./frontend)
export CHANGED_BACKEND=$(__git_check_if_changed ./backend)
export CHANGED_INFRA=$(__git_check_if_changed ./infra)
CODE EDITOR
Google codebuild
Base on -> https://cloud.google.com/architecture/managing-infrastructure-as-code
@eavichay
CODE EDITOR
Google codebuild
CODE EDITOR
Google codebuild
CODE EDITOR
Google codebuild
03 Github Actions
CODE EDITOR
ci-mode
#!/bin/bash
__git_check_if_changed() {
if [ -z $IS_GITHUB ]; then
git diff --name-only --quiet HEAD -- $1
else
git diff --name-only --quiet HEAD^..HEAD -- $1
fi
# git diff --quiet ${github.ref}HEAD -- $1
echo $?
}
CODE EDITOR
ci-mode
If ./terraform files in git changeset
then terraform workspace select $env
tf apply -auto-approve
If ./backend files in git changeset
Docker build + push all backend components
Then terraform workspace select $env
tf apply -auto-approve
If ./frontend files in git changeset
Upload files to s3 static + invalidation cloudfront
tf apply -auto-approve
end
```
`
CODE EDITOR
Pseudo
pipeline
If we could freestyle it ...
If ./terraform files in git changeset
then terraform workspace select $env
tf apply -auto-approve
If ./backend files in git changeset
Docker build + push all backend components
Then terraform workspace select $env
tf apply -auto-approve
If ./frontend files in git changeset
Upload files to s3 static + invalidation cloudfront
tf apply -auto-approve
end
`
My Journey.tf
Everything in 1 repo [ fe + be code, terraform iac, helm deployment]
Running Terraform with Github Actions
Ahoy! -> Insurance for Recreational boats
The Continuous Infrastructure:
Terraform Workspace == Protected / Official Branch
● 1 Infrastructure Repository
● 3 environments - 3 branches (main, staging, dev)
● Trigger based on certain directory in changeset
-> quirky but works !
●
CODE EDITOR
ci-mode | brach == workspace
steps:
- name: gcr.io/${PROJECT_ID}/terraform:0.14.7
entrypoint: bash
args:
- '-c'
- |
cd /workspace/infrastructure/terraform/cloud-core;
terraform init;
if [ "${BRANCH_NAME}" == "master" ]; then
terraform workspace select production;
cp /workspace/infrastructure/terraform/production.tfvars /workspace/apply.tfvars;
gcloud container clusters get-credentials production-cluster --zone=us-east1-b
elif [ "${BRANCH_NAME}" == "staging" ]; then
cp /workspace/infrastructure/terraform/staging.tfvars /workspace/apply.tfvars;
gcloud container clusters get-credentials staging-cluster --zone=us-east1-b
terraform workspace select staging;
CODE EDITOR
ci-mode
steps:
- name: gcr.io/${PROJECT_ID}/terraform:0.14.7
entrypoint: bash
args:
...
exit
fi
terraform plan -var-file=/workspace/apply.tfvars -no-color -out=/workspace/tfplan-core;
terraform apply -input=false /workspace/tfplan-core;
My Journey.tf
Github Actions
My Journey.tf
Github Actions
https://learn.hashicorp.com/tutorials/terraform/github-actions
04 Gitlab Runner + terragrunt || terraform
GitOps -> gitlab-ci.yml pipelines for terra*
Gitlab ci / pipelines
CODE EDITOR
gitlab-ci.yml
image:
name: hashicorp/terraform:1.0.4
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
CODE EDITOR
Vault (secrets Manager) ping
vault ping:
stage: .pre
script:
- echo "Check status of $VAULT_ADDR"
- |
until vault status
do
echo "Vault returned error or sealed"
sleep 5
done
rules:
- if: '$VAULT_ADDR'
when: always
CODE EDITOR
terraform apply -auto-approve
apply:
stage: apply
extends: .secrets
script:
- *install-curl-jq
- *gitlab-tf-backend
- terraform apply -auto-approve
- DYNAMIC_ENVIRONMENT_URL=$(terraform output -no-color env-dynamic-url)
- echo "DYNAMIC_ENVIRONMENT_URL=$DYNAMIC_ENVIRONMENT_URL" >> deploy.env
dependencies:
- plan production
artifacts:
expire_in: 1 week
name: $CI_COMMIT_REF_SLUG
reports:
dotenv: deploy.env
Increase Developers & Operations Productivity
Continuous deployment automation with an integrated feedback control loop speeds up
Mean Time to Deployment -> ship often isn’t just a catchy phrase !
Enhanced Developer Experience
Push code and not containers.
Developers can use familiar tools like Git to manage updates and features to Kubernetes more
rapidly without having to know the internal of Kubernetes. Newly on-boarded developers can get
quickly up to speed and be productive within days instead of months.
Improved Stability
When you use Git workflows to manage your cluster, you automatically gain a convenient audit
log of all cluster changes outside of Kubernetes. An audit trail of who did what, and when to your
cluster can be used to meet SOC 2 compliance and ensure stability.
Higher Reliability
With Git’s capability to revert/rollback and fork, you gain stable and reproducible rollbacks.
Because your entire system is described in Git, you also have a single source of truth from which
to recover after a meltdown, reducing your meantime to recovery (MTTR) from hours to minutes.
Consistency and Standardization
GitOps provides one model for making infrastructure, apps and Kubernetes add-on
changes, you have consistent end-to-end workflows across your entire organization.
Not only are your continuous integration and continuous deployment pipelines all driven by pull
request, but your operations tasks are also fully reproducible through Git.
Stronger Security Guarantees
Git’s strong correctness and security guarantees, backed by the strong cryptography used to
track and manage changes, as well as the ability to sign changes to prove authorship and origin
is key to a secure definition of the desired state of the cluster.
Git ops  & Continuous Infrastructure with terra*
Git ops  & Continuous Infrastructure with terra*

More Related Content

What's hot

DevOps with GitHub Actions
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps with GitHub ActionsNilesh Gule
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowAnton Babenko
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingPiotr Perzyna
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introductionJason Vance
 
Gitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operationsGitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operationsMariano Cunietti
 
GitOps 101 Presentation.pdf
GitOps 101 Presentation.pdfGitOps 101 Presentation.pdf
GitOps 101 Presentation.pdfssuser31375f
 
Kubermatic CNCF Webinar - start.kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdfKubermatic CNCF Webinar - start.kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdfLibbySchulze
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCDOmar Fathy
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Brian Brazil
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideBytemark
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleKnoldus Inc.
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for KubernetesCarlos E. Salazar
 
Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Krishna-Kumar
 
Kubernetes and Prometheus
Kubernetes and PrometheusKubernetes and Prometheus
Kubernetes and PrometheusWeaveworks
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeMartin Schütte
 

What's hot (20)

Meetup 23 - 03 - Application Delivery on K8S with GitOps
Meetup 23 - 03 - Application Delivery on K8S with GitOpsMeetup 23 - 03 - Application Delivery on K8S with GitOps
Meetup 23 - 03 - Application Delivery on K8S with GitOps
 
DevOps with GitHub Actions
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps with GitHub Actions
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
 
Terraform
TerraformTerraform
Terraform
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 
Gitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operationsGitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operations
 
GitOps 101 Presentation.pdf
GitOps 101 Presentation.pdfGitOps 101 Presentation.pdf
GitOps 101 Presentation.pdf
 
Kubermatic CNCF Webinar - start.kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdfKubermatic CNCF Webinar - start.kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdf
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCD
 
Terraform
TerraformTerraform
Terraform
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
GitOps w/argocd
GitOps w/argocdGitOps w/argocd
GitOps w/argocd
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for Kubernetes
 
Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!
 
Kubernetes and Prometheus
Kubernetes and PrometheusKubernetes and Prometheus
Kubernetes and Prometheus
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
 

Similar to Git ops & Continuous Infrastructure with terra*

DevOps Online Training in Hyderabad
DevOps Online Training in HyderabadDevOps Online Training in Hyderabad
DevOps Online Training in HyderabadVisualpath Training
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxMrJustbis
 
Terraform GitOps on Codefresh
Terraform GitOps on CodefreshTerraform GitOps on Codefresh
Terraform GitOps on CodefreshCodefresh
 
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDKubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDSunnyvale
 
Git Gerrit Mit Teamforge
Git Gerrit Mit TeamforgeGit Gerrit Mit Teamforge
Git Gerrit Mit TeamforgeCollabNet
 
Git/Gerrit with TeamForge
Git/Gerrit with TeamForgeGit/Gerrit with TeamForge
Git/Gerrit with TeamForgeCollabNet
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersMartin Jinoch
 
[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructureRodrigo Stefani Domingues
 
Managing Github via Terrafom.pdf
Managing Github via Terrafom.pdfManaging Github via Terrafom.pdf
Managing Github via Terrafom.pdfmicharaeck
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopAnis Ahmad
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment. A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment. Tal Hibner
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based TerraformAndrew Kirkpatrick
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_finalMythri P K
 
Terraform: Tales from the Trenches
Terraform: Tales from the TrenchesTerraform: Tales from the Trenches
Terraform: Tales from the TrenchesRobert Fox
 
Deploy Application Files with Git
Deploy Application Files with GitDeploy Application Files with Git
Deploy Application Files with GitAlec Clews
 
The journey to GitOps
The journey to GitOpsThe journey to GitOps
The journey to GitOpsNicola Baldi
 

Similar to Git ops & Continuous Infrastructure with terra* (20)

DevOps Online Training in Hyderabad
DevOps Online Training in HyderabadDevOps Online Training in Hyderabad
DevOps Online Training in Hyderabad
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptx
 
Terraform GitOps on Codefresh
Terraform GitOps on CodefreshTerraform GitOps on Codefresh
Terraform GitOps on Codefresh
 
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDKubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
 
Git Gerrit Mit Teamforge
Git Gerrit Mit TeamforgeGit Gerrit Mit Teamforge
Git Gerrit Mit Teamforge
 
Git/Gerrit with TeamForge
Git/Gerrit with TeamForgeGit/Gerrit with TeamForge
Git/Gerrit with TeamForge
 
20221130 - Luxembourg HUG Meetup
20221130 - Luxembourg HUG Meetup20221130 - Luxembourg HUG Meetup
20221130 - Luxembourg HUG Meetup
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
 
[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure
 
Managing Github via Terrafom.pdf
Managing Github via Terrafom.pdfManaging Github via Terrafom.pdf
Managing Github via Terrafom.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT Workshop
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment. A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based Terraform
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
 
Git and github
Git and githubGit and github
Git and github
 
Terraform: Tales from the Trenches
Terraform: Tales from the TrenchesTerraform: Tales from the Trenches
Terraform: Tales from the Trenches
 
Deploy Application Files with Git
Deploy Application Files with GitDeploy Application Files with Git
Deploy Application Files with Git
 
The journey to GitOps
The journey to GitOpsThe journey to GitOps
The journey to GitOps
 

More from Haggai Philip Zagury

DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...Haggai Philip Zagury
 
Kube Security Shifting left | Scanners & OPA
Kube Security Shifting left | Scanners & OPAKube Security Shifting left | Scanners & OPA
Kube Security Shifting left | Scanners & OPAHaggai Philip Zagury
 
TechRadarCon 2022 | Have you built your platform yet ?
TechRadarCon 2022 | Have you built your platform yet ?TechRadarCon 2022 | Have you built your platform yet ?
TechRadarCon 2022 | Have you built your platform yet ?Haggai Philip Zagury
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3sHaggai Philip Zagury
 
The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2Haggai Philip Zagury
 
Deep Learning - Continuous Operations
Deep Learning - Continuous Operations Deep Learning - Continuous Operations
Deep Learning - Continuous Operations Haggai Philip Zagury
 
Machine Learning - Continuous operations
Machine Learning - Continuous operationsMachine Learning - Continuous operations
Machine Learning - Continuous operationsHaggai Philip Zagury
 
Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]Haggai Philip Zagury
 

More from Haggai Philip Zagury (20)

DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
 
Kube Security Shifting left | Scanners & OPA
Kube Security Shifting left | Scanners & OPAKube Security Shifting left | Scanners & OPA
Kube Security Shifting left | Scanners & OPA
 
TechRadarCon 2022 | Have you built your platform yet ?
TechRadarCon 2022 | Have you built your platform yet ?TechRadarCon 2022 | Have you built your platform yet ?
TechRadarCon 2022 | Have you built your platform yet ?
 
Gitlab, GitOps & ArgoCD
Gitlab, GitOps & ArgoCDGitlab, GitOps & ArgoCD
Gitlab, GitOps & ArgoCD
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3s
 
Auth experience - vol 1.0
Auth experience  - vol 1.0Auth experience  - vol 1.0
Auth experience - vol 1.0
 
Linux intro
Linux introLinux intro
Linux intro
 
Auth experience
Auth experienceAuth experience
Auth experience
 
Kubexperience intro session
Kubexperience intro sessionKubexperience intro session
Kubexperience intro session
 
Scaling i/o bound Microservices
Scaling i/o bound MicroservicesScaling i/o bound Microservices
Scaling i/o bound Microservices
 
The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2
 
Terraform 101
Terraform 101Terraform 101
Terraform 101
 
Chaos is a ladder !
Chaos is a ladder !Chaos is a ladder !
Chaos is a ladder !
 
Natively clouded Journey
Natively clouded JourneyNatively clouded Journey
Natively clouded Journey
 
Deep Learning - Continuous Operations
Deep Learning - Continuous Operations Deep Learning - Continuous Operations
Deep Learning - Continuous Operations
 
Terraform 101
Terraform 101Terraform 101
Terraform 101
 
Helm intro
Helm introHelm intro
Helm intro
 
Machine Learning - Continuous operations
Machine Learning - Continuous operationsMachine Learning - Continuous operations
Machine Learning - Continuous operations
 
Whats all the FaaS About
Whats all the FaaS AboutWhats all the FaaS About
Whats all the FaaS About
 
Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]
 

Recently uploaded

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Git ops & Continuous Infrastructure with terra*

  • 1. Copyright © 2021 HashiCorp GitOps & Continuous Infrastructure with Terra* Haggai Philip Zagury, DevOps Group & Tech lead September 2021
  • 2. Focus for today's talk - why GitOps GitOps Every Change is Driven by a change in source control
  • 3. Focus for today's talk - why GitOps GitOps Every Change is Driven by a change in source control Alexis Richardson coined the term Gitops in 2017. Gitops is the new phase of DevOps that many organizations are adopting, in which all the infrastructure will be stored in Git as code and will be used for continuous deployment #1 - The entire system described declaratively. #2 - The canonical desired system state versioned in Git. #3 - Approved changes that can be automatically applied to the system. ------ #4 - Software agents to ensure correctness and alert on divergence.
  • 4. My Journey.tf Using terraform in various use cases, adv, caveats Working with terraform for the past 5 years (at least) Love & Hate relationship with State management - From tiny projects (single main.tf file)
  • 5. My Journey.tf Using terraform in various use cases, adv, caveats Working with terraform for the past 5 years (at least) Love & Hate relationship with State management - From tiny projects (single main.tf file) - To 10’s of *.tf files - Have you seen 001_s3.tf, 002_iam.tf … - Things can break very fast ....
  • 6. My Journey.tf Using terraform in various use cases, adv, caveats Working with terraform for the past 5 years (at least) Love & Hate relationship with State management - From tiny projects (single main.tf file) - To 10’s of *.tf files - Upgrading to terraform 0.13 - What comes first ? Account / S3 / Dynamodb lock table ? - Terraform without terraform cloud ?! (for small teams / startups)
  • 7. My Journey.tf Using terraform in various use cases, adv, caveats Working with terraform for the past 5 years (at least) Love & Hate relationship with State management - From tiny projects (single main.tf file) - To 10’s of *.tf files - Upgrading to terraform 0.13 - What comes first ? Account / S3 / Dynamodb lock table ? - Terraform without terraform cloud ?! (for small teams / startups) - Seamless integration with Consul / Vault (more on that later) The ones I worked with ;)
  • 8. My Journey.tf Using terraform in various use cases, adv, caveats Working with terraform for the past 5 years (at least) Love & Hate relationship with State management - From tiny projects (single main.tf file) - To 10’s of *.tf files - Upgrading to terraform 0.13 - What comes first ? Account / S3 / Dynamodb lock table ? - Terraform without terraform cloud ?! (for small teams / startups) - Seamless integration with Consul / Vault (more on that later) - Cloud Native Technologies
  • 9. My Journey.tf For a while my life was waiting for these ...
  • 10. My Journey.tf For a while my life was waiting for these ...
  • 12. Focus for today's talk GitOps Every Change is Driven by a change in source control (git is standard scm hence GitOps) Continuous Infrastructure & Operations Utilizing DevOps best-practices and tools enabling and entire SDLC based on Git Operations.
  • 14. 01 GitOps the early days ... Terraform Cloud
  • 15. 01 GitOps the early days ... Terraform Cloud || Run from your laptop
  • 16. 01 GitOps the early days ... Terraform Cloud || Run from your laptop
  • 17. CODE EDITOR dev-mode #!/bin/bash __git_check_if_changed() { git diff --name-only --quiet HEAD^..HEAD -- $1 echo $? } export CHANGED_FRONTEND=$(__git_check_if_changed ./frontend) export CHANGED_BACKEND=$(__git_check_if_changed ./backend) export CHANGED_INFRA=$(__git_check_if_changed ./infra)
  • 18. CODE EDITOR Google codebuild Base on -> https://cloud.google.com/architecture/managing-infrastructure-as-code @eavichay
  • 23. CODE EDITOR ci-mode #!/bin/bash __git_check_if_changed() { if [ -z $IS_GITHUB ]; then git diff --name-only --quiet HEAD -- $1 else git diff --name-only --quiet HEAD^..HEAD -- $1 fi # git diff --quiet ${github.ref}HEAD -- $1 echo $? }
  • 24. CODE EDITOR ci-mode If ./terraform files in git changeset then terraform workspace select $env tf apply -auto-approve If ./backend files in git changeset Docker build + push all backend components Then terraform workspace select $env tf apply -auto-approve If ./frontend files in git changeset Upload files to s3 static + invalidation cloudfront tf apply -auto-approve end ``` `
  • 25. CODE EDITOR Pseudo pipeline If we could freestyle it ... If ./terraform files in git changeset then terraform workspace select $env tf apply -auto-approve If ./backend files in git changeset Docker build + push all backend components Then terraform workspace select $env tf apply -auto-approve If ./frontend files in git changeset Upload files to s3 static + invalidation cloudfront tf apply -auto-approve end `
  • 26. My Journey.tf Everything in 1 repo [ fe + be code, terraform iac, helm deployment]
  • 27. Running Terraform with Github Actions Ahoy! -> Insurance for Recreational boats The Continuous Infrastructure: Terraform Workspace == Protected / Official Branch ● 1 Infrastructure Repository ● 3 environments - 3 branches (main, staging, dev) ● Trigger based on certain directory in changeset -> quirky but works ! ●
  • 28. CODE EDITOR ci-mode | brach == workspace steps: - name: gcr.io/${PROJECT_ID}/terraform:0.14.7 entrypoint: bash args: - '-c' - | cd /workspace/infrastructure/terraform/cloud-core; terraform init; if [ "${BRANCH_NAME}" == "master" ]; then terraform workspace select production; cp /workspace/infrastructure/terraform/production.tfvars /workspace/apply.tfvars; gcloud container clusters get-credentials production-cluster --zone=us-east1-b elif [ "${BRANCH_NAME}" == "staging" ]; then cp /workspace/infrastructure/terraform/staging.tfvars /workspace/apply.tfvars; gcloud container clusters get-credentials staging-cluster --zone=us-east1-b terraform workspace select staging;
  • 29. CODE EDITOR ci-mode steps: - name: gcr.io/${PROJECT_ID}/terraform:0.14.7 entrypoint: bash args: ... exit fi terraform plan -var-file=/workspace/apply.tfvars -no-color -out=/workspace/tfplan-core; terraform apply -input=false /workspace/tfplan-core;
  • 32. 04 Gitlab Runner + terragrunt || terraform
  • 33. GitOps -> gitlab-ci.yml pipelines for terra* Gitlab ci / pipelines
  • 34. CODE EDITOR gitlab-ci.yml image: name: hashicorp/terraform:1.0.4 entrypoint: - '/usr/bin/env' - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
  • 35. CODE EDITOR Vault (secrets Manager) ping vault ping: stage: .pre script: - echo "Check status of $VAULT_ADDR" - | until vault status do echo "Vault returned error or sealed" sleep 5 done rules: - if: '$VAULT_ADDR' when: always
  • 36. CODE EDITOR terraform apply -auto-approve apply: stage: apply extends: .secrets script: - *install-curl-jq - *gitlab-tf-backend - terraform apply -auto-approve - DYNAMIC_ENVIRONMENT_URL=$(terraform output -no-color env-dynamic-url) - echo "DYNAMIC_ENVIRONMENT_URL=$DYNAMIC_ENVIRONMENT_URL" >> deploy.env dependencies: - plan production artifacts: expire_in: 1 week name: $CI_COMMIT_REF_SLUG reports: dotenv: deploy.env
  • 37.
  • 38. Increase Developers & Operations Productivity Continuous deployment automation with an integrated feedback control loop speeds up Mean Time to Deployment -> ship often isn’t just a catchy phrase ! Enhanced Developer Experience Push code and not containers. Developers can use familiar tools like Git to manage updates and features to Kubernetes more rapidly without having to know the internal of Kubernetes. Newly on-boarded developers can get quickly up to speed and be productive within days instead of months.
  • 39. Improved Stability When you use Git workflows to manage your cluster, you automatically gain a convenient audit log of all cluster changes outside of Kubernetes. An audit trail of who did what, and when to your cluster can be used to meet SOC 2 compliance and ensure stability. Higher Reliability With Git’s capability to revert/rollback and fork, you gain stable and reproducible rollbacks. Because your entire system is described in Git, you also have a single source of truth from which to recover after a meltdown, reducing your meantime to recovery (MTTR) from hours to minutes.
  • 40. Consistency and Standardization GitOps provides one model for making infrastructure, apps and Kubernetes add-on changes, you have consistent end-to-end workflows across your entire organization. Not only are your continuous integration and continuous deployment pipelines all driven by pull request, but your operations tasks are also fully reproducible through Git. Stronger Security Guarantees Git’s strong correctness and security guarantees, backed by the strong cryptography used to track and manage changes, as well as the ability to sign changes to prove authorship and origin is key to a secure definition of the desired state of the cluster.