Skip to content

Commit

Permalink
docs: start building out multi-cluster example
Browse files Browse the repository at this point in the history
  • Loading branch information
tinyzimmer committed Oct 15, 2023
1 parent f14e473 commit 05a0cfa
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ data:
cluster-domain: "cluster.local"
# TODO: Currently IPv6 address space is computed at bootstrap,
# But we should allow this to be configured with the IPv4 address space.
pod-cidr: "10.42.0.0/16,fd00:10:24::/48"
pod-cidr: "10.42.0.0/16,fd00:10:42::/48"
service-cidr: "10.96.0.0/12,fd00:10:96::/112"
# The network config to install on each node.
# You can enable/disable IPv4/IPv6 on dual-stack nodes by adjusting the
Expand Down
2 changes: 1 addition & 1 deletion deploy/config/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data:
cluster-domain: "cluster.local"
# TODO: Currently IPv6 address space is computed at bootstrap,
# But we should allow this to be configured with the IPv4 address space.
pod-cidr: "10.42.0.0/16,fd00:10:24::/48"
pod-cidr: "10.42.0.0/16,fd00:10:42::/48"
service-cidr: "10.96.0.0/12,fd00:10:96::/112"
# The network config to install on each node.
# You can enable/disable IPv4/IPv6 on dual-stack nodes by adjusting the
Expand Down
1 change: 1 addition & 0 deletions examples/multi-cluster/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.kubeconfig
6 changes: 1 addition & 5 deletions examples/multi-cluster/cluster-one.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: webmesh-cni
name: multi-cluster-one
networking:
ipFamily: dual
disableDefaultCNI: true
Expand All @@ -12,7 +12,3 @@ nodes:
extraMounts:
- hostPath: /dev/net/tun
containerPath: /dev/net/tun
- role: worker
extraMounts:
- hostPath: /dev/net/tun
containerPath: /dev/net/tun
6 changes: 1 addition & 5 deletions examples/multi-cluster/cluster-two.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: webmesh-cni
name: multi-cluster-two
networking:
ipFamily: dual
disableDefaultCNI: true
Expand All @@ -12,7 +12,3 @@ nodes:
extraMounts:
- hostPath: /dev/net/tun
containerPath: /dev/net/tun
- role: worker
extraMounts:
- hostPath: /dev/net/tun
containerPath: /dev/net/tun
33 changes: 33 additions & 0 deletions examples/multi-cluster/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

CLUSTER_NAME_PREFIX=${CLUSTER_NAME_PREFIX:-multi-cluster}

set -ex

# Create the clusters

kind create cluster \
--name ${CLUSTER_NAME_PREFIX}-one \
--config ./cluster-one.yaml \
--kubeconfig ./cluster-one.kubeconfig
kubectl --kubeconfig ./cluster-one.kubeconfig \
config set-context --current --namespace kube-system

kind create cluster \
--name ${CLUSTER_NAME_PREFIX}-two \
--config ./cluster-two.yaml \
--kubeconfig ./cluster-two.kubeconfig
kubectl --kubeconfig ./cluster-two.kubeconfig \
config set-context --current --namespace kube-system

# Install the kubernetes configurations to each cluster

kubectl --kubeconfig ./cluster-one.kubeconfig \
--namespace kube-system \
create secret generic cluster-two-credentials \
--from-file=kubeconfig=./cluster-two.kubeconfig

kubectl --kubeconfig ./cluster-two.kubeconfig \
--namespace kube-system \
create secret generic cluster-one-credentials \
--from-file=kubeconfig=./cluster-one.kubeconfig
9 changes: 9 additions & 0 deletions examples/multi-cluster/teardown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CLUSTER_NAME_PREFIX=${CLUSTER_NAME_PREFIX:-multi-cluster}

set -ex

kind delete cluster --name ${CLUSTER_NAME_PREFIX}-one
kind delete cluster --name ${CLUSTER_NAME_PREFIX}-two
rm -f cluster-one.kubeconfig cluster-two.kubeconfig

0 comments on commit 05a0cfa

Please sign in to comment.