Last active
June 23, 2021 10:14
-
-
Save JrCs/8c1ce999a1cf4a5e5ba5114e83558b3a to your computer and use it in GitHub Desktop.
kind-environment
This file contains 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
#!/bin/bash | |
set -eu | |
mkdir -p bin | |
[[ ! -x bin/kubectl ]] \ | |
&& curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/$(uname| tr '[:upper:]' '[:lower:]')/amd64/kubectl \ | |
&& chmod +rx kubectl \ | |
&& mv kubectl bin/ | |
#kind | |
[[ ! -x bin/kind ]] \ | |
&& curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.8.0/kind-$(uname)-amd64" \ | |
&& chmod +x ./kind \ | |
&& mv ./kind bin/ | |
cat > kind-config.yml <<EOF | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
kind: Cluster | |
nodes: | |
- role: control-plane | |
- role: worker | |
kubeadmConfigPatches: | |
- | | |
kind: ClusterConfiguration | |
metadata: | |
name: config | |
apiServer: | |
extraArgs: | |
"feature-gates": "EphemeralContainers=true" | |
"service-account-issuer": "kubernetes.default.svc" | |
"service-account-signing-key-file": "/etc/kubernetes/pki/sa.key" | |
EOF | |
#k9s | |
[[ ! -x bin/k9s ]] \ | |
&& curl -L https://github.com/derailed/k9s/releases/download/v0.19.3/k9s_$(uname)_x86_64.tar.gz \ | |
| tar xzf - k9s && mv k9s bin/ | |
cat >env.sh <<EOF | |
export PATH=\${PWD}/bin:\$PATH | |
source <(kubectl completion bash) | |
source <(kind completion bash) | |
alias k='kubectl' | |
complete -o default -F __start_kubectl k | |
EOF | |
cat >create-cluster.sh <<EOF | |
#!/bin/bash | |
kind create cluster --config ./kind-config.yml | |
EOF | |
chmod +rx create-cluster.sh | |
echo "You need to source the env.sh:" | |
echo "source ./env.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment