Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support KIND running inside container #40

Open
axsaucedo opened this issue Jun 25, 2021 · 1 comment
Open

Support KIND running inside container #40

axsaucedo opened this issue Jun 25, 2021 · 1 comment

Comments

@axsaucedo
Copy link

Currently we have KIND running in our Kubernetes CI, where KIND runs inside of a pod/container, which requires the following mounts with the node:

                volumeMounts:
                  - mountPath: /lib/modules
                    name: modules
                    readOnly: true
                  - mountPath: /sys/fs/cgroup
                    name: cgroup
                  - name: dind-storage
                    mountPath: /var/lib/docker
                securityContext:
                  privileged: true
                imagePullPolicy: Always
              volumes:
                - name: modules
                  hostPath:
                    path: /lib/modules
                    type: Directory
                - name: cgroup
                  hostPath:
                    path: /sys/fs/cgroup
                    type: Directory
                - name: dind-storage
                  emptyDir: {}

When running a KIND docker action inside a KIND enabled container (which works on kubernetes) such as:

...
    runs-on: ubuntu-18.04
    container: repo/container:tag
...

It seems to work when running it locally using act (https://github.com/nektos/act), but when running it on the github Actions worker, I get the error Error: Kubernetes cluster unreachable: Get https://127.0.0.1:34221/version?timeout=32s: dial tcp 127.0.0.1:34221: connect: connection refused.

The KIND cluster does seem to get correctly created, but the issue seems to mainly be that the cluster is not reachable. Is this an issue that you have come across before?

There would be a lot of advantages running KIND inside container, such as being able to have a replicatable environment from where to run the creation of resources, running the tests with pytest, etc.

@radu-matei
Copy link
Member

The first thing I can think of is that Docker-in-Docker needs a privileged container to start.
So whenever starting the container, the --privileged flag has to be passed.

See this thread for people talking about this option in GH Actions, I'm not sure if it is working or supported - actions/container-action#2 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants