A Kubernetes mutating webhook server that implements environnement variable injection.
A Kubernetes cluster (v1.19+) with the admissionregistration.k8s.io/v1beta1
API enabled.
Verify that by the following command :
kubectl api-versions | grep admissionregistration.k8s.io
Create a namespace
with the label env-injection: true
:
apiVersion: v1
kind: Namespace
metadata:
name: my-namespace
labels:
env-injection: true
Change the namespace
or create a k8-env
namespace and create a kustomization.yaml
file :
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: k8-env
resources:
- https://raw.githubusercontent.com/orange-cloudavenue/k8-env/v0.1.0/manifests/manifests.yaml
images:
- name: k8-env
newName: ghcr.io/orange-cloudavenue/k8-env
newTag: v0.1.0
configMapGenerator:
- name: k8-env
behavior: replace
files:
- envconfig.yaml
Create a envconfig.yaml
with the environment variables to inject :
env:
- name: ENV_VAR_1
value: "value1"
- name: ENV_VAR_2
value: "value2"