jakubhajek / flux-capi-multi-tenant-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flux, Cluster API, Multi-Tenancy Demo

Requirements

πŸ“‚ Folder Structure

β”œβ”€β”€ clusters            # These manifests are used in provisioning clusters using Cluster API.
β”‚   β”œβ”€β”€ cluster0.yaml
β”‚   β”œβ”€β”€ cluster1.yaml
β”‚   └── cluster2.yaml
└── manifests           # These manifests are deployed onto the various clusters, including workload and management.
    β”œβ”€β”€ _base
    β”‚   β”œβ”€β”€ base-namespace
    β”‚   └── ...
    β”œβ”€β”€ cluster0
    β”‚   β”œβ”€β”€ foo-namespace
    β”‚   └── ...
    β”œβ”€β”€ cluster1
    β”‚   β”œβ”€β”€ monitoring
    β”‚   └── ...
    β”œβ”€β”€ cluster2
    β”‚   └── ...
    └── management
    β”‚   β”œβ”€β”€ flux-system # The manifests needed to deploy and configure Flux
    β”‚   └── ...

🚧 Provisioning management cluster

This is one of the initial manual tasks needed, this should only need doing once! Once the management cluster is running it will handle all deployments and provisioning of new clusters.

# create cluster using k3d - you can also minikube, kind etc.
k3d cluster create management-test

# clusterctl init (! this uses your current kube context !)
clusterctl init --infrastructure docker

Once the management cluster is running, you can bootstrap Flux onto the cluster to deploy all the relevant manifests.

flux check --pre
kubectl create namespace flux-system

# bootstrap flux onto the management cluster - you may need to run this twice due to race conditions
kubectl apply -k ./manifests/management

βœ… Validating

kubectl get clusters -A

NAMESPACE   NAME       AGE     PHASE
default     cluster0   5m58s   Provisioned
default     cluster1   5m58s   Provisioned
default     cluster2   5m58s   Provisioned

About

License:MIT License