Created
June 21, 2024 17:00
-
-
Save rjchicago/cbd4e48abc763a737b11164f69eabc54 to your computer and use it in GitHub Desktop.
k2d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# K2D | |
# <https://docs.k2d.io/quick-start-guide> | |
SECRET=asdasd | |
docker run --rm -d \ | |
--name k2d-k2d \ | |
--network bridge \ | |
--publish 6443:6443 \ | |
--env K2D_ADVERTISE_ADDR=$(ipconfig getifaddr en0) \ | |
--env K2D_SECRET=$SECRET \ | |
--label resource.k2d.io/namespace-name=k2d \ | |
--label workload.k2d.io/name=k2d \ | |
--volume /var/run/docker.sock:/var/run/docker.sock \ | |
--volume ~/.k2d:/var/lib/k2d \ | |
portainer/k2d:1.0.0 | |
# get k2d kubeconfig | |
curl --insecure -H "Authorization: Bearer $(cat ~/.k2d/token)" "https://$(ipconfig getifaddr en0):6443/k2d/kubeconfig" > ~/.kube/k2d.yml | |
# export KUBECONFIG | |
export KUBECONFIG=~/.kube/config$(for YAML in $(find ${HOME}/.kube -name '*.y*ml') ; do echo -n ":${YAML}"; done) | |
# usage | |
kubectl config use-context k2d | |
kubectl describe pod k2d -n k2d | |
# cleanup | |
docker stop k2d-k2d | |
rm -rf ~/.k2d | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment