istio.io/istio@v0.0.0-20240520182934-d79c90f27776/samples/kind-lb/README.md (about) 1 2 # Create a KinD cluster with an external load balancer 3 4 This bash script sets up a k8s cluster using kind and metallb on Linux. 5 6 WARNING: when it runs in an environment other than Linux, it will only 7 produce an error message. 8 9 The following dependencies must be installed before running the script: 10 1. kubectl 11 2. kind 12 3. docker 13 14 Usage: 15 16 ```bash 17 ./setupkind.sh --cluster-name cluster1 --k8s-release 1.22.1 --ip-space 255 -i dual 18 19 Where: 20 -n|--cluster-name - name of the k8s cluster to be created 21 -r|--k8s-release - the release of the k8s to setup, latest available if not given 22 -s|--ip-space - the 2nd to the last part for public ip addresses, 255 if not given, valid range: 0-255. 23 -m|--mode - setup the required number of nodes per deployment model. Values are sidecar (1 node) or ambient (minimum of 2) 24 -w|--worker-nodes - the number of worker nodes to create. Default is 1 25 --pod-subnet - the pod subnet to specify. Default is 10.244.0.0/16 for IPv4 and fd00:10:244::/56 for IPv6 26 --service-subnet - the service subnet to specify. Default is 10.96.0.0/16 for IPv4 and fd00:10:96::/112 for IPv6 27 -i|--ip-family - ip family to be supported, default is ipv4 only. Value should be ipv4, ipv6, or dual 28 --ipv6gw - set ipv6 as the gateway, necessary for dual-stack IPv6-preferred clusters 29 -h|--help - print the usage of this script" 30 ``` 31 32 The `ip-space` parameter controls the IP range that metallb will use for allocating 33 the public IP addresses for load balancer resources. It will be used for both IPv4 34 and IPv6 public IP address allocation. 35 36 The public IPs are dictated by the docker network's subnet which `KinD` creates 37 when it creates a k8s cluster. This parameter is used as the 3rd octet for the 38 public IP v4 addresses when a load balancer is created. The default value is 255. 39 The first two octets are determined by the docker network created by `KinD`, the 4th octet 40 is hard coded as 200-240. As you might have guessed, for each k8s cluster one can 41 create at most 40 public IP v4 addresses. 42 43 The `ip-space` parameter is not required when you create just one cluster, however, when 44 running multiple k8s clusters it is important to proivde different values for each cluster 45 to avoid overlapping addresses. 46 47 For example, to create two clusters, run the script two times with the following 48 parameters: 49 50 ```bash 51 ./setupkind.sh --cluster-name cluster1 --ip-space 255 -i dual 52 ./setupkind.sh --cluster-name cluster2 --ip-space 245 -i dual 53 ``` 54 55 To setup a dual-stack cluster that prefers IPv6 instead of IPv4 (the default) 56 57 ```bash 58 ./setupkind.sh --cluster-name cluster2 --ip-space 245 -i dual --pod-subnet "fd00:100:96::/48,100.96.0.0/11" --service-subnet "fd00:100:64::/108,100.64.0.0/13" --ipv6gw 59 ```