Skip to content

Instantly share code, notes, and snippets.

@johananl
Last active September 9, 2021 15:47
Show Gist options
  • Save johananl/3ad27a63a50557b4d8e724f7840e3f82 to your computer and use it in GitHub Desktop.
Save johananl/3ad27a63a50557b4d8e724f7840e3f82 to your computer and use it in GitHub Desktop.
Get kubeconfig access to CAPI e2e kind cluster
export container_name=$(docker ps --format '{{.Names}}' | grep test-.\*-control-plane)
export host_port=$(docker inspect $container_name -f '{{(index (index .NetworkSettings.Ports "6443/tcp") 0).HostPort}}')
docker exec $container_name cat /etc/kubernetes/admin.conf | sed "s/server: https:\/\/${container_name}:6443/server: https:\/\/localhost:${host_port}/" > /tmp/kubeconfig
export KUBECONFIG=/tmp/kubeconfig
kubectl get pods -A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment