#!/bin/bash #! /bin/bash # This script sets up k8s cluster using metallb and istio # Make sure you have the following executable in your path # kubectl # kind # istioctl # Setup some colors ColorOff='\033[0m' # Text Reset Black='\033[0;30m' # Black Red='\033[0;31m' # Red Green='\033[0;32m' # Green K8S_RELEASE=$1 # Get all the available releases alltags=$(wget -q https://registry.hub.docker.com/v1/repositories/kindest/node/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}') rm -rf ~/.kube/* if [ -z $K8S_RELEASE ]; then kind create cluster else if [[ "$alltags" == *"$K8S_RELEASE"* ]]; then kind create cluster --image=kindest/node:$K8S_RELEASE else echo "Available k8s releases are $alltags" exit 1 fi fi # The following procedure is to setup load balancer kubectl cluster-info --context kind-kind kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/master/manifests/namespace.yaml kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)" kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/master/manifests/metallb.yaml PREFIX=$(docker network inspect -f '{{range .IPAM.Config }}{{ .Gateway }}{{end}}' kind | cut -d '.' -f1,2) cat <
Tuesday, August 10, 2021
Setup k8s cluster with kind using different k8s releases
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment