'How do I configure my Kubernetes cluster to work with Gitlab CI?
I'm learning how to use Kubernetes and Gitlab CI/CD so I installed a Gitlab agent into my Kubernetes cluster by following the documentation. I wrote a simple hello world pipeline to see if it works
image: "docker.io/ubuntu"
stages:
- build
build-contabo:
stage: build
script:
- echo "hello world"
But the pipeline won't run and complains about missing configuration:
Running with gitlab-runner 14.6.0 (5316d4ac)
on vmi769777 NWjdRisx
Preparing the "kubernetes" executor 00:09
WARNING: Namespace is empty, therefore assuming 'default'.
Using Kubernetes namespace: default
ERROR: Preparation failed: getting Kubernetes config: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
I read on how to configure an agent, but could not find anything addressed this error. I also deployed a hello world kubernetes deployment to check if my cluster does not work, but it ran successfully.
How can I provide configurations so that my pipeline runs? And is this a problem with the Kubernetes Cluster or the Gitlab configuration?
Solution 1:[1]
Have you tried setting KUBE_CONFIG_PATH? I was getting the same error, but export KUBE_CONFIG_PATH=/path/to/kubeconfig seems to fix the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 90linux |
