Summary
The user, a maintainer of Crossplane, shares their positive experience with the Earthly build system and asks about running end-to-end tests that deploy Crossplane into a Kubernetes cluster. They want to inspect the cluster during development but face difficulties accessing the running Earthly container until after a test failure. The user seeks a method to find and exec into the container while it is still running, similar to using docker ls
and docker exec
. They provide a detailed process for identifying and entering the runc container running in Earthly, including commands for listing containers, entering the container, and using kubectl to connect to the cluster. They also suggest creating aliases for easier access to kubectl commands and enabling bash completions for improved usability.
turkenh
<@U07KG62GVGR> Thanks a lot, it worked like a charm :tada:
rrjjvv
The question reminded me of two of my feature requests; neither will directly help you, but they're in the neighborhood: https://github.com/earthly/earthly/issues/3697 and https://github.com/earthly/earthly/issues/2047. I use basically the exact same technique that Samuel posted above. It's easy to get lost in the layers, but it works.
sloury
Hi.
I understand that you are doing k8s in docker, right?
I maintain a tool called "clk k8s" that is meant to bootstrap a k8s cluster indocker, with all the stuff I generally need, like the ingress controller,certificat manager, reloader etc.
When I need to investigate an issue with the cluster run in docker in earthly,this is what I do. I hope it will help you.
First, find the id of the runc container running in earthly.
earthly will run a different runc container per RUN, so wait until you got intothe WITH DOCKER before doing that.
In case you have only one earthly job running, you can use the following shortcut
Then, enter that runc container with
This entered the container that ran k8s in docker, so from here you can runkubectl to connect to your cluster.
Of course, this can be aliased
So that you can call
Or even better
So that you can call
The good thing with the iktl is that you can use kubectl bash completions with it
$ iktl get pod [TAB]
An you get the completion on pods.
turkenh
:wave: Hello folks,
https://github.com/crossplane/crossplane|Crossplane maintainer here. We recently replaced our make-based build system with Earthly and have had a great experience so far. Thank you for the neat tool :raised_hands:
I have a question: We are also running our e2e tests as an Earthly target which deploys Crossplane into a kubernetes cluster and runs our e2e tests. During development, usually I would like to inspect the cluster and see what is going on. However, I couldn’t manage to see/exec into the Earthly container. earthly -i
only helps after the test fails and gave the shell to me.
Ideally, I am looking for an experience like finding the container with docker ls
and exec into it with docker exec
while it is running. Are there any ways to achieve something similar?