github.com/buildtool/build-tools@v0.2.29-0.20240322150259-6a1d0a553c23/www/docs/config/k8s.md (about) 1 # Kubernetes 2 3 Descriptor files are placed in a `k8s` directory in the root of your project file. This directory contains all the yaml 4 files used to describe the Kubernetes deployment tasks needed to run this service. Target specific files are handled by 5 using a `-<target>` "suffix", i.e. `ingress-prod.yaml`. 6 7 Files with a `.yaml` suffix will 8 be [applied](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply) to the Kubernetes cluster. 9 10 If both a **common** file and a **target-specific** file with the same "basename", i.e. service.yaml and 11 service-local.yaml, only the **target-specific** file will be applied for a `target` and the **common** file will be 12 applied to all other targets. 13 14 Files with a `.sh` suffix will be run on the machine executing the [`deploy`](/commands/deploy) command. This can be 15 useful to setup secrets/configurations, mostly for local use. Note that only `.sh` files matching the `target` using the 16 rules in the above paragraph will be executed, with the difference that no **common** files will be executed. 17 18 All other files in `k8s` will be ignored by the `deploy` command. 19 20 ## Available variables 21 The following variables are possible to use for substitution in the descriptor files: 22 23 24 | Parameter | Description | 25 |:------------|:------------------------------------------------------------| 26 | `IMAGE` | The full image name (`registry/name:tag`) | 27 | `COMMIT` | The commit SHA (`3b701067e6a6943c773b9dc183fcc39cd31a2ff0`) | 28 | `TIMESTAMP` | The current time (`2022-02-22T09:16:01+01:00`) | 29 30 31 ## Example 32 33 ```` 34 $ cd projecct 35 $ tree 36 . 37 └── k8s 38 ├── deploy.yaml 39 ├── ingress-local.yaml 40 ├── ingress-prod.yaml 41 ├── service.yaml 42 ├── service-local.yaml 43 └── setup-local.sh 44 └── skipped.sh 45 ```` 46 47 Given the structure above: 48 49 ````sh 50 deploy local 51 ```` 52 53 Will apply `deploy.yaml`, `ingress-local.yaml` and `service-local.yaml` and execute `setup-local.sh`. 54 55 ````sh 56 deploy staging 57 ```` 58 59 Will apply `deploy.yaml` and `service.yaml`. 60 61 ````sh 62 deploy prod 63 ```` 64 65 Will apply `deploy.yaml`, `ingress-prod.yaml` and `service.yaml`.