How to start Kubernetes in a pipeline for e2e tests?

Hi guys,
I am currently looking for ways to start a minimal k8s (k3s) inside a pipeline and run my application tests against it. I have looked into this and then thought maybe I could do something like:

- name: e2e-test
  image: docker
  - DOCKER_HOST=unix:///drone/docker.sock
  - sleep 10
  - curl -s | bash
  - k3d create
  - export KUBECONFIG=$(k3d get-kubeconfig)
  - make e2e # could be run here, although I would need golang to be available in my image
  - k3d delete

    image: docker:dind
    privileged: true
    command: [ '-H', 'unix:///drone/docker.sock' ]

So, any recommendations? would it make sense to create an image for k8s/test step that includes both docker and Golang (my e2e tests are written in Go)?

1 Like

Does it work?

I briefly thought of this recently, but dismissed the idea as i couldn’t think of how to solve the privileged flag. You did that already… so iguess it worth a try.

I think the recommended way of doing this is with services to host the containers.

See “docker” and “docker dind” at for inspiration.

I should mention i have not gotten this to work due to network issues (Docker in Docker networking problems: unable to expose ports) though - not sure why, but you might have better luck.