Container created by gitlab-runner can't see local network

I am using and my runners are running in my local on-premise infrastructure.

I have the following stage in my gitlab-ci file

  image: dtzar/helm-kubectl
  stage: deploy
    - tags
    - mkdir -p /root/.kube/ && touch /root/.kube/config
    - echo ${KUBERNETES_KUBE_CONFIG} | base64 -d > ${KUBECONFIG}
    - ping -c 4
    - kubectl get pods -v7
    - kubectl apply -f kubernetes/deployment.yaml

kubectl has been failing with the error

Unable to connect to the server: dial tcp i/o timeout

I put the ping debug in to check that I could at least see the server, but get back the following

PING ( 56 data bytes
--- ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss

If I run the following command manually on the same VM that gitlab-runner is on

docker run -it -v ~/.kube:/root/.kube dtzar/helm-kubectl

it mounts the same kube config as in my deploy script and drops me in to a bash shell and I can successfully run

bash-5.1# kubectl get pods
NAME                             READY   STATUS    RESTARTS   AGE
gitlab-runner-6cb5bcc665-s9hhf   1/1     Running   0          34h
nginx-hello-54bc7788-8ccgn       1/1     Running   1          7d6h
nginx-hello-54bc7788-h2qcm       1/1     Running   1          7d6h
nginx-hello-54bc7788-nvmwj       1/1     Running   1          7d6h
nginx-hello-54bc7788-wm9f6       1/1     Running   1          7d6h
vuejs-release-5cbff5955b-22gr6   1/1     Running   0          23m
vuejs-release-5cbff5955b-p7rrj   1/1     Running   0          23m

So in summary, the same Docker container that can see the local network when run manually is not able to see the network when started by the gitlab-runner

Hi @simonjcarr
I don’t see in the .gitlab-ci.yml that you specify it should use your runner.
Have you disabled shared runners and configured your Runner to pickup untagged jobs?

@balonik Thank you. Can’t believe I missed the tag. I will give that a try and I am confident it will probably work.