Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jayunit100/b151eeb28c5f7604cf2b35b493ea5400 to your computer and use it in GitHub Desktop.
Save jayunit100/b151eeb28c5f7604cf2b35b493ea5400 to your computer and use it in GitHub Desktop.
cat << EOF > calico-conf.yaml
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
networking:
disableDefaultCNI: true # disable kindnet
podSubnet: 192.168.0.0/16 # set to Calico's default subnet
nodes:
- role: control-plane
- role: worker
- role: worker
EOF
function install_k8s() {
if kind delete cluster --name calico-test; then
echo "deleted old kind cluster, creating a new one..."
fi
kind create cluster --name calico-test --config calico-conf.yaml
export KUBECONFIG="$(kind get kubeconfig-path --name=calico-test)"
for i in "cni-plugin" "node" "pod2daemon" "kube-controllers"; do
echo "...$i"
done
chmod 755 ~/.kube/kind-config-kind
export KUBECONFIG="$(kind get kubeconfig-path --name=calico-test)"
until kubectl cluster-info; do
echo "`date`waiting for cluster..."
sleep 2
done
}
function install_calico() {
kubectl get pods
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true
kubectl -n kube-system set env daemonset/calico-node FELIX_XDPENABLED=false
sleep 5 ; kubectl -n kube-system get pods | grep calico-node
echo "will wait for calico to start running now... "
while true ; do
kubectl -n kube-system get pods
sleep 3
done
}
install_k8s
install_calico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment