All Projects → tumblr → K8s Sidecar Injector

tumblr / K8s Sidecar Injector

Licence: apache-2.0
Kubernetes sidecar injection service

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to K8s Sidecar Injector

Secretscanner
Find secrets and passwords in container images and file systems
Stars: ✭ 895 (+219.64%)
Mutual labels:  containers, k8s
Training
Container, Monitoring & Logging, Cloud & DevOps Tutorials and Labs
Stars: ✭ 121 (-56.79%)
Mutual labels:  containers, k8s
Cilium
eBPF-based Networking, Security, and Observability
Stars: ✭ 10,256 (+3562.86%)
Mutual labels:  containers, k8s
Adapt
ReactJS for your infrastructure. Create and deploy full-stack apps to any infrastructure using the power of React.
Stars: ✭ 317 (+13.21%)
Mutual labels:  containers, k8s
Choerodon
Open Source Multi-Cloud Integrated Platform
Stars: ✭ 2,149 (+667.5%)
Mutual labels:  containers, k8s
Sparrow
运维管理平台(python3+flask+pycharts+apscheduler+gunicorn),模块化结构设计,底层依托mysql、influxdb、elasticsearch、zabbix、k8s等数据源数据
Stars: ✭ 723 (+158.21%)
Mutual labels:  containers, k8s
Container Service Extension
Container Service for VMware vCloud Director
Stars: ✭ 66 (-76.43%)
Mutual labels:  containers, k8s
Geodesic
🚀 Geodesic is a DevOps Linux Distro. We use it as a cloud automation shell. It's the fastest way to get up and running with a rock solid Open Source toolchain. ★ this repo! https://slack.cloudposse.com/
Stars: ✭ 629 (+124.64%)
Mutual labels:  containers, k8s
Kubernetes 101
Kubernetes 101 - by Jeff Geerling
Stars: ✭ 169 (-39.64%)
Mutual labels:  containers, k8s
Knctl
Knative CLI
Stars: ✭ 163 (-41.79%)
Mutual labels:  containers, k8s
Kata Containers
Kata Containers version 2.x repository. Kata Containers is an open source project and community working to build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers, but provide the workload isolation and security advantages of VMs. https://katacontainers.io/
Stars: ✭ 1,053 (+276.07%)
Mutual labels:  containers, k8s
Mayastor
A cloud native declarative data plane in containers for containers
Stars: ✭ 215 (-23.21%)
Mutual labels:  containers, k8s
Kathara
A lightweight container-based network emulation system.
Stars: ✭ 139 (-50.36%)
Mutual labels:  containers, k8s
Runtime
Kata Containers version 1.x runtime (for version 2.x see https://github.com/kata-containers/kata-containers).
Stars: ✭ 2,103 (+651.07%)
Mutual labels:  containers, k8s
K8s Tew
Kubernetes - The Easier Way
Stars: ✭ 269 (-3.93%)
Mutual labels:  containers, k8s
Dockly
Immersive terminal interface for managing docker containers and services
Stars: ✭ 3,034 (+983.57%)
Mutual labels:  containers
Lxd
Powerful system container and virtual machine manager
Stars: ✭ 3,115 (+1012.5%)
Mutual labels:  containers
Blockchain Network On Kubernetes
Demonstrates the steps involved in setting up your business network on Hyperledger Fabric using Kubernetes APIs on IBM Cloud Kubernetes Service.
Stars: ✭ 261 (-6.79%)
Mutual labels:  containers
Polyaxon
Machine Learning Platform for Kubernetes (MLOps tools for experimentation and automation)
Stars: ✭ 2,966 (+959.29%)
Mutual labels:  k8s
Kubernetes Certified Administrator
Online resources that will help you prepare for taking the CNCF CKA 2020 "Kubernetes Certified Administrator" Certification exam. with time, This is not likely the comprehensive up to date list - please make a pull request if there something that should be added here.
Stars: ✭ 3,438 (+1127.86%)
Mutual labels:  k8s

k8s-sidecar-injector

Uses MutatingAdmissionWebhook in Kubernetes to inject sidecars into new deployments at resource creation time

GitHub release Travis (.org) Docker Automated build Docker Build Status MicroBadger Size Docker Pulls Docker Stars Godoc

What is this?

At Tumblr, we run some containers that have complicated sidecar setups. A kubernetes pod may run 5+ other containers, with some associated volumes and environment variables. It became clear quickly that keeping these sidecars in line would become an operational hassle; making sure every service uses the correct version of each dependency, updating global environment variable sets as configurations in our DCs change, etc.

To help solve this, we wrote the k8s-sidecar-injector. It is a small service that runs in each Kubernetes cluster, and listens to the Kubernetes API via webhooks. For each pod creation, the injector gets a (mutating admission) webhook, asking whether or not to allow the pod launch, and if allowed, what changes we would like to make to it. For pods that have special annotations on them (i.e. injector.tumblr.com/request=logger:v1), we rewrite the pod configuration to include the containers, volumes, volume mounts, host aliases, init-containers and environment variables defined in the sidecar logger:v1's configuration.

This enabled us to keep sane, centralized configuration for oft-used, but infrequently cared about configuration for our sidecars.

Configuration

See /docs/configuration.md to get started with setting up your sidecar injector's configurations.

Deployment

See /docs/deployment.md to see what a sample deployment may look like for you!

How it works

  1. A pod is created. It has annotation injector.tumblr.com/request=logger:v1
  2. K8s webhooks out to this service, asking whether to allow this pod creation, and how to mutate it
  3. If the pod is annotated with injector.tumblr.com/status=injected: Do nothing! Return "allowed" to pod creation
  4. Pull the "logger:v1" sidecar config, patch the resource, and return it to k8s
  5. Pod will launch in k8s with the modified configuration

A crappy ASCII diagram will help :)

                                                                  +-----------------+
     +------------------------------+          +----------------+ |                 |
     |                              |          |                | |  Sidecar        |
     |   MutatingAdmissionWebhook   |          |   Sidecar      | |  configuration  |
     |                              |          |   ConfigMaps   | |  files on disk  |
     +------------+-----------------+          |                | |                 |
                  |                            +--------+-------+ +------+----------+
discover injector |                                     |                |
endpoints         |                    watch ConfigMaps |                | load from disk
                  |                                     |                |
          +-------v--------+    pod launch          +---v----------------v-----+
          |                +------------------------>                          |
          |   Kubernetes   |                        |   k8s-sidecar-injector   |
          |   API Server   <------------------------+                          |
          |                |    mutated pod spec    +--------------------------+
          +----------------+

Run

The image is build and published on the Hub at https://hub.docker.com/r/tumblr/k8s-sidecar-injector/. See /docs/deployment.md for how to run this in Kubernetes.

By hand

This needs some special configuration surrounding the TLS certs, but if you have already read docs/configuration.md, you can run this manually with:

$ ./bin/k8s-sidecar-injector --tls-port=9000 --config-directory=conf/ --tls-cert-file="${TLS_CERT_FILE}" --tls-key-file="${TLS_KEY_FILE}"

NOTE: this is not a supported method of running in production. You are highly encouraged to read docs/deployment.md to deploy this to Kubernetes in The Supported Way.

Hacking

See hacking.md

License

Apache 2.0

Copyright 2019, Tumblr, Inc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].