Giter Club home page Giter Club logo

gitops-vault's Introduction

GitOps-Vault

Manging application secrets is not an easy task in GitOps due to git as a single source of truth philosophy !
A lot of efforts have been done to mitigate secret exposure risk, one of which is using HashiCorp- Vault.
Recently, IBM team developed a plugin customized to argocd & vault, it aimed to find a simple way to utilize Vault without having to rely on an operator or custom resource definition.

  • To authenticate vault with argocd, it follows vault approle method:
    Image_12
  • The config of the admin side, some of it done as env vars.
  • The Application in the above pic equivalent to the plugin job.

The rest of this small doc is a demo of the plugin and GitOps, enjoy! ๐Ÿฟ

Argocd-Vault-Plugin

After you set up vault, you need to update the configuration of your argocd to download & register the used plugin "AVP" either:

  • using initContainer to download the plugin
  • building a new image for argocd repo server

in both way, you have to edit the argocd-cm with the default plugin command to run.

Notes: ๐Ÿ“ข

  • AVP prefix is super important! ๐Ÿšจ๐Ÿ”ฅ
    Image 1
  • if your vault in same cluster, then the address is : http://SERVICENAME.NAMESPACE.svc:PORT, otherwise the plugin will not work! โšก
    Image 2
  • set the right permissions and path in the attached policy, otherwise you will get a permission denied issue! ๐Ÿ›‘
    didn't take a screenshot :( ๐Ÿ˜ฌ, so ...
  • make sure of the secret id ttl, if you are not an expert with vault, I recommand leaving it default way!:vertical_traffic_light:
  • using vault http api from inside a pod where vault deployed is super useful way of debugging!:construction:

Implementation:

Preparation

To manage secrets using Vault plugin in GitOps:

Updating k8s secret file with:

  1. Add annotation with the secret path in vault ( there is another way to do so, you can find it here)
  2. Replace the secret value with <KEY-NAME>, by encoding it this way, the plugin will recognize it and replace it with the real value, EXAMPLE:

Image 3

You can find it here

Argocd

You need to select the plugin while creating the application whether using the UI or YAML:

Image 4

Tool's Result:

  • creating an application with the plugin in Argocd, after it deployed:
    Image 5

and that is all!! ๐Ÿคนโ€โ™€๏ธ

Verifying if it is working as expected

Get the secret value in k8s ๐Ÿ˜‡
Image 6

decode it ๐Ÿค”
Image 7

what is the stored value in vault? ๐Ÿคจ
Image 8

Yeah ๐Ÿ˜

Updating Secret Value in Vault

After Creating a new vesion of the secret in Vault

Depending on the Sync policy of Argocd application

Image 9

after syncing, Check the secret
Image 10

Updated value in Vault
Image 11

Quick Compersion Between Secret Management Tools used in GitOps:

Here is a small compersion between two common secret managment tools that are used in GitOps:

Sealed Secret AVP
Deals with Secret Object Only Deals with all k8s Object as long as it has avp annotation
Easy setup Needs more steps
who has access to both git and k8s cluster can see the secret's value the secret stored in Vault, therefore you need access to it to access secret's vaule

References

gitops-vault's People

Contributors

saloyiana avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.