java – connect to a k3s container with kubectl

I have been using a k3s cluster running in a docker container with testcontainers to run integration tests.

I would like to put a breakpoint in my tests and inspect the k3s cluster with kubectl.
When the execution stops on the breakpoint, I run the following commands:

kubectl config set-cluster my-k3s-cluster --server=https://localhost:52067
kubectl config set-context my-k3s --cluster=my-k3s-cluster
kubectl config use-context my-k3s

But when I run any command (eg: kubectl get pods), the cluster asks me for credentials.

Is there any way to start the k3s cluster disabling authentication?

Read more here: Source link