Commit bfb4fe99 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

docs: mention the use of KUBE_CONTEXT variable with GitLab agents

parent 467ab821
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -99,8 +99,8 @@ You're free to enable whichever or both, and you can also choose your deployment

The Kubernetes template supports 3 ways of login/accessing your Kubernetes cluster(s):

1. The [GitLab Kubernetes integration](https://docs.gitlab.com/ee/user/project/clusters/): when enabled, the template
  automatically retrieves and uses your Kubernetes cluster configuration (`KUBECONFIG` env),
1. Using [GitLab agents with the CI/CD workflow](https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_workflow.html): when enabled, the template automatically retrieves and uses your Kubernetes cluster configuration (`KUBECONFIG` env),
    :warning: don't forget to set the `KUBE_CONTEXT` variable (to `path/to/agent/project:agent-name`) as [stated in the documentation](https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_workflow.html#environments-that-use-auto-devops).
2. By defining an explicit `kubeconfig` from env (either file or yaml content),
3. By defining explicit `kubeconfig` **exploded parameters** from env: server url, server certificate authority and user token.

@@ -387,6 +387,7 @@ The Kubernetes template uses some global configuration used throughout all jobs.
| `kubectl-image` / `K8S_KUBECTL_IMAGE` | the Docker image used to run Kubernetes `kubectl` commands <br/>:warning: **set the version required by your Kubernetes server**                                        | `registry.hub.docker.com/bitnami/kubectl:latest`                                                       |
| `base-app-name` / `K8S_BASE_APP_NAME` | Default application name                                                                                                                                                | `$CI_PROJECT_NAME` ([see GitLab doc](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)) |
| `environment-url` / `K8S_ENVIRONMENT_URL`    | Default environments url _(only define for static environment URLs declaration)_<br/>_supports late variable expansion (ex: `https://%{environment_name}.k8s.acme.com`)_ | _none_                                                                                                 |
| `KUBE_CONTEXT`      | Defines the context to be used in `KUBECONFIG`. When using [GitLab agents with the CI/CD workflow](https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_workflow.html), the value should be like `path/to/agent/project:agent-name`. To use different agents per environment, define an [environment-scoped CI/CD variable](https://docs.gitlab.com/ee/ci/environments/index.html#limit-the-environment-scope-of-a-cicd-variable) for each agent. | _none_ |
| :lock: `K8S_DEFAULT_KUBE_CONFIG`| The default kubeconfig to use (either content or file variable)                                                                                                         | **required if not using exploded kubeconfig parameters**                                               |
| `url` / `K8S_URL` | the Kubernetes API url                                                                                                                                                  | **required if using exploded kubeconfig parameters**                                                   |
| :lock: `K8S_CA_CERT`          | the default Kubernetes server certificate authority                                                                                                                     | **optional if using exploded kubeconfig parameters**                                                   |