fix k3d kubeconfig for Docker runner
Kube-bench CIS scan / Scan ephemeral K3s cluster (push) Failing after 55s

This commit is contained in:
2026-08-11 17:00:44 -04:00
parent 22ccecc363
commit c0a6c050b5
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -42,6 +42,15 @@ jobs:
run: |
k3d cluster delete security-baseline-ci >/dev/null 2>&1 || true
k3d cluster create --config ci/k3d-ci-cluster-config.yaml
mkdir -p "$HOME/.kube"
k3d kubeconfig get security-baseline-ci > "$HOME/.kube/config"
api_host=127.0.0.1
if getent hosts host.docker.internal >/dev/null 2>&1; then
api_host=host.docker.internal
elif command -v ip >/dev/null 2>&1; then
api_host="$(ip route | awk '/default/ {print $3; exit}')"
fi
sed -i -E "s#https://0\.0\.0\.0:#https://${api_host}:#" "$HOME/.kube/config"
kubectl wait --for=condition=Ready nodes --all --timeout=180s
kubectl get nodes -o wide