Heads-up: this revision is meant for illustrating how you template well with ytt.
To get started quickly, switch to the master branch:
$ git checkout master $ git clean -df... and start from there.
If you are keen to learn how to use the k14s toolchain skillfully, good on ya. Let's carry on...
We externalize commonly specified configuration into "data values."
This is done by:
- creating a new file named
_defaults.yaml
- the
@data/values
annotation marks this as a "data values" file ytt
loads configuration values from such files, first, before rendering any templates
- the
- declaring variables in the data values file (in YAML format)
- loading the
data
ytt library in each template and using those data values.
Remember this:
Externalize what the user must own.
In other templating systems, the author must externalize all variables that the user might want to change. This can result in an explosion of input values, making it harder to understand.
With ytt
, when the user wants to own a piece of configuration, they can use an overlay to make the change.
Examine the changes to the configuration to see how this is true:
$ git show -- config
- Obtain and target a Kubernetes Cluster.
- absent another option, see Creating a KIND Cluster, below.
- Deploy the application to the cluster:
$ ytt -f config/application-name | kubectl apply -f- deployment.apps/application-name-server created ingress.extensions/application-name created service/application-service-name created
- Verify the deployment
$ curl localhost/app/
- Re-deploy the application, specifying the environment name
$ ytt -f config/application-name -v "environmentName=pink-poodle" | kubectl apply -f-
- Verify that the deployment was updated
$ curl localhost/app/
- install KIND.
- create the cluster:
$ kind create cluster --config=config/kind-cluster/cluster.yaml
- install the Ingress Controller
$ kubectl apply -f config/kind-cluster/ingress-nginx.yaml
In the next revision,
$ git checkout rev3 && git clean -df