A Kubernetes Admission Controller that injects PodPresets into pods across all namespaces
10K+
ClusterPreset is a Kubernetes admission controller that injects common environment variables, volumes, and volume mounts into all pods running in the cluster.
It functions similar to PodPresets except that is not limited to a single namespace.
Unlike other solutions that exist, ClusterPresets do not require pods to be labeled for data injection.
This is currently an alpha project. Ideally, we want to help contribute this functionality upstream. While we work with the community on driving a canonical solution forward, we've open sourced the one we're using.
The cluster-preset container is built using docker-buildx to provide support across multiple architectures. The following os/architecture pairs are currently supported:
linux/amd64linux/arm64linux/arm/v7The current set of Kubernetes configurations requires use of cert-manager. cert-manager is used to mint and issue TLS certificates using custom resource definitions. Installing the system is pretty easy.
$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v0.8.0/cert-manager.yaml
Once the system is up and running, you'll be able to spin up cluster-preset pretty quickly. First, let's apply the default configuration to get things up and running.
$ kubectl apply -f https://raw.githubusercontent.com/indeedeng/cluster-preset/master/k8s/certificate.yaml
$ kubectl apply -f https://raw.githubusercontent.com/indeedeng/cluster-preset/master/k8s/manifest.yaml
$ kubectl apply -f https://raw.githubusercontent.com/indeedeng/cluster-preset/master/k8s/webhook.yaml
Once everything is up and running, you can quickly test out the defaults:
$ kubectl run -it --rm --restart=Never alpine --image=alpine -- sh
# echo "${CLUSTER}"
us-west-1
# echo "${STAGING_LEVEL}"
production
From there, you can update the ConfigMap used by the cluster-preset.
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-presets-config
namespace: kube-system
labels:
app: cluster-presets
data:
presets.yaml: |
env:
- name: YOUR_VARIABLE
value: your_value
- name: YOUR_VARIABLE
value: your_value
kubectl apply -f config.yaml
Once you've updated the config map, it can take up to a minute for the configuration to be reloaded.
This can be configured to be a smaller interval with the --reload <Duration> option.
See our Contributing guide for how you can help contribute to this project!
Current project code owners:
We are working on providing a channel for communication. In the meantime, open a ticket, watch, or star the repository.
ClusterPreset is governed by the Contributor Covenant v1.4.1.
ClusterPreset is licensed under the MIT License.
Content type
Image
Digest
Size
52.9 MB
Last updated
over 7 years ago
docker pull indeedoss/cluster-preset