Hello everyone,
Issue
- I’m unable to mount the Kubernetes configuration with docker container created by docker executor
Details
- According to what I know GitLab provides different types of runners like a shell, docker, Kubernetes, and others. I was trying to use docker runner which was creating a docker container in the VM (where my Kubernetes cluster is running) and the container doesn’t have configuration mounted on it I was trying to see how GitLab allows mounting configuration of the cluster to its container.
As the jobs run inside the container it is throwing error like:
- When I run
kubectl config view
from the GitLab docker container it doesn’t show any config.
$ kubectl config view
apiVersion: v1
clusters: null
contexts: null
current-context: ""
kind: Config
preferences: {}
users: null
- When I run go-client to deploy some application then it thows error:
Unable to Get the kubeconfig, due to {open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory}
Expected
<*os.PathError | 0xc000414090>: {
Op: "open",
Path: "/var/run/secrets/kubernetes.io/serviceaccount/token",
Err: 0x2,
}
to be nil
-
kubectl get nodes
from container
error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
- The config.toml file is:
[[runners]]
name = "pod-level-e2e"
url = "XXXXXXXXXXXXXXXXX"
token = "XXXXXXXXXXXXXXXXXXXX"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "uditgaurav/litmus-runner:e2e"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
So, How to mount the Kubernetes configuration to the docker container?