Skip to content

setup_kubeconfig fails as kubectl is not installed on the apline/helm image

Describe the bug

When using the Gitlab K8S Agent KUBECONFIG and KUBE_CONTEXT variables are provided to the template. Since 4.1.6 when it runs setup_kubeconfig it throws a kubectl: command not found error.

After inverstigation, it tries to run kubectl config use-context "$KUBE_CONTEXT" on the apline/helm image but kubectl isn't installed on that image. As noted by P.-A. in kubernetes#36 (closed) we might have a workaround using the $HELM_KUBECONTEXT environment property.

Expected behavior

Helm is set up using the right KUBE_CONTEXT

Actual behavior

To-be-continous template can't find the kubectl command

Logs and/or screenshots

image

Context & Configuration

The issue was reproduced using:

  • Version of the template: 4.1
  • GitLab server(s): self-managed Gitlab server on GitLab Community Edition 15.10.8
  • GitLab runner(s): (type in any relevant information about the GitLab runner(s) you used)

Configured GitLab CI project or group variables:

  • KUBE_CONTEXT : set to the Gitlab K8S Agent