Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
set -eux
DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
KIND_IMAGE="kindest/node:v1.27.3"
# deploy_kind installs the kind cluster
deploy_kind() {
cat <<EOF | kind create cluster --image ${KIND_IMAGE} --config=- --kubeconfig=${DIR}/kubeconfig
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
podSubnet: $NET_CIDR_IPV4,$NET_CIDR_IPV6
serviceSubnet: $SVC_CIDR_IPV4,$SVC_CIDR_IPV6
ipFamily: $IP_FAMILY
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
apiServer:
extraArgs:
v: "5"
controllerManager:
extraArgs:
v: "5"
scheduler:
extraArgs:
v: "5"
- role: worker
- role: worker
EOF
}
# install_netobserv-agent will install the daemonset
# into each kind docker container
install_netobserv-agent() {
docker build . -t localhost/ebpf-agent:test
kind load docker-image localhost/ebpf-agent:test
kubectl apply -f ${DIR}/agent.yml
}
# print_success prints a little success message at the end of the script
print_success() {
set +x
echo "Your kind cluster was created successfully"
echo "Run the following to load the kubeconfig:"
echo "export KUBECONFIG=${DIR}/kubeconfig"
set -x
}
KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-kind}"
IP_FAMILY=${IP_FAMILY:-dual}
NET_CIDR_IPV4=${NET_CIDR_IPV4:-10.244.0.0/16}
SVC_CIDR_IPV4=${SVC_CIDR_IPV4:-10.96.0.0/16}
NET_CIDR_IPV6=${NET_CIDR_IPV6:-fd00:10:244::/48}
SVC_CIDR_IPV6=${SVC_CIDR_IPV6:-fd00:10:96::/112}
# At the minimum, deploy the kind cluster
deploy_kind
export KUBECONFIG=${DIR}/kubeconfig
oc label node kind-worker node-role.kubernetes.io/worker=
oc label node kind-worker2 node-role.kubernetes.io/worker=
install_netobserv-agent
# Print success at the end of this script
print_success