curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/sbin/kind
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
mkdir -p ~/.local/bin/kubectl
mv ./kubectl /usr/local/sbin/kubectl
kubectl completion bash > /etc/bash_completion.d/kubectl
echo 'source <(kubectl completion bash)' >>~/.bashrc
echo 'alias k=kubectl' >>~/.bashrc
echo 'complete -F __start_kubectl k' >>~/.bashrc
cat << EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: control-plane
- role: control-plane
- role: worker
EOF
cat << EOF | kind create cluster --name ${HOSTNAME} --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
ipFamily: ipv4
apiServerAddress: "$(hostname -i)"
apiServerPort: 6443
podSubnet: "192.168.225.0/24"
serviceSubnet: "192.168.226.0/24"
disableDefaultCNI: false
kubeProxyMode: "ipvs"
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 80
hostPort: 80
listenAddress: 0.0.0.0
protocol: TCP
- role: worker
image: kindest/node:v1.16.4@sha256:b91a2c2317a000f3a783489dfb755064177dbc3a0b2f4147d50f04825d016f55
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "version=v1.16.4"
extraMounts:
- hostPath: /tmp/
containerPath: /files
readOnly: false
# https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation (None, HostToContainer or Bidirectional)
propagation: HostToContainer
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.configs."registry.dev.example.com".tls]
cert_file = "/etc/docker/certs.d/registry.dev.example.com/ba_client.cert"
key_file = "/etc/docker/certs.d/registry.dev.example.com/ba_client.key"
EOF
kind delete cluster --name ${HOSTNAME}