Overview
Kyma Binding is a component that allows you to inject values from a Secret or ConfigMap to the resources such as Deployment, which have a Pod template underneath.
Prerequisites
- Helm in version 3.0 or higher
- Kubernetes in version 1.16 or higher
Installation
To install the Kyma Binding component on your cluster, run:
helm install binding ./charts/binding --wait
Walkthrough
Go through the short tutorial that presents the useage and capabilities of the component.
- Register a TargetKind. It's a resource that defines how and where environments can be injected.
kubectl apply -f ./examples/target-kind-deployment.yaml
- Check if the TargetKind is registered properly:
kubectl get targetkinds.bindings.kyma-project.io
- Create a Deployment into which environments will be injected:
kubectl apply -f ./examples/deployment.yaml
- Port-forward the Pod when it's ready:
kubectl port-forward svc/env-sample 8080:8080
-
Check the browser on http://localhost:8080
. You can see that there are no environments injected.
-
Create a Secret:
kubectl create secret generic secret-with-credentials --from-literal=APP_PASSWORD='super_secret_password' --from-literal=APP_TOKEN='token_to_app'
- When the Secret is ready, create a Binding that injects data from the Secret to the Pod:
kubectl apply -f ./examples/secret-binding.yaml
-
Check again the browser. Environments are now injected under the Password and Token keys.
-
You can also inject environments from a ConfigMap. To check this out, create a ConfigMap and a Binding that injects parameters to our Pod:
kubectl apply -f ./examples/config-map.yaml
kubectl apply -f ./examples/config-map-binding.yaml
- Check the browser on
http://localhost:8080
. There are three environments injected.