GithubHelp home page GithubHelp logo

delineaxpm / dsv-k8s-sidecar Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 8.52 MB

Plugin for DSV Kubernetes sidecar.

License: MIT License

Dockerfile 1.02% Shell 1.45% Batchfile 0.30% Go 87.83% JavaScript 0.27% Starlark 5.78% Smarty 3.35%
dsv kubernetes

dsv-k8s-sidecar's Introduction

dsv-k8s-sidecar

Overview

There are two applications that are built in this repo:

Application Description
dsv-k8s-sidecar Responsible for fetching and periodically updating a configuration file stored at a shared volume that is used by the pods.
dsv-k8s-controller The controller watches for new pods with the specific annotation dsv to come online with the value of the tenant intended to be used, it then adds this pod to the internal registry.

Note There is no guarantee that the file has been created by the time the companion containers are online.

Installing

Both the sidecar & controller have helm charts located in charts with README.md files containing a reference for the input values required.

How It Works

See Architecture for more detail.

The general concept is:

  • DSV Controller retrieves and caches secrets from DSV.
  • Authenticated sidecar pods communicate with a unique JWT to the DSV Controller requesting the desired secrets.
  • The secret is either read from the in-memory cache or retrieved if non-existent.

FAQ

  • Do I need more than one controller?
    • One controller can do the job required.
    • If you want to scope the controller to a specific namespace and/or client credential for more isolation, then you could consider installing more.

Development

Possible Future Improvements

  • Push token instead of pull
  • Certificate auth instead of JWT

If there are needs missing for your usage, feel free to open a GitHub issue describing your challenges and any suggestions for improvement.

Sample Applications for QA Testing

Running Project Against Local Kind Cluster

Note Further directions on development setup are in Developer - Tasks.

  • mage cert:generate to create the local certs in .cache directory.

Currently if you copy these into artifacts, it will apply.

  • For creation of the secret in development mode: mage k8s:createsecret
  • For a customer: kubectl create secret generic keys --from-file=mysecretpath/server.key --from-file=mysecretpath/server.crt

Dev Deployment:

  • Deploy the manifests individually: mage k8s:apply ./.cache/charts/k8s/controller.yml.
  • Deploy all locally: mage helm:install.

Optional Running Locally with TLS

There are two communication channels between sidecar and controller:

  1. Getting JWT token via http/https
  2. Secrets via GRPC

Optionally we can encrypt these communications at container level.

Generate self signed certificate

  • run mage cert:generate and choose Sidecar To Controller: This will generate certs and keys in .cache folder.
  • create kubernetes secret: mage k8s:createsecret or manually: kubectl create secret generic keys --from-file=key.pem --from-file=cert.pem --from-file=ca.pem

Sidecar to Controller GRPC

Add above k8 secret as volume in Controller's k8 deployment and add the name of cert and private key name env in k8 values.yml.

  • KEY_DIR => the volume directory.
  • SERVER_CRT => this will be certs.
  • SERVER_KEY => this will be private key.

Sidecar to Controller Token

Add above k8 secret as volume in sidecar's k8 deployment and add the name of cert env in k8 values.yml.

  • KEY_DIR => the volume directory.
  • SERVER_CRT => this will be certs.

Once the above setup is done all kubernetes secret will mapped to volume and both the sidecar and controller will pick certificates up from volume.

Additional Resources

  • Developer: instructions on running tests, local tooling, and other resources.
  • DSV Documentation
  • DSV-K8S is another approach using a Kubernetes syncing and injector hook to directly update Kubernetes secrets. This alternative approach does not leverage a sidecar.

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.