The demo stuff for the loft.sh vcluster meetup on Sept 26th, 2022.
- vcluster
- cluster-api
- cluster-api-provider-vcluster
- Quick-start guide to build a AWS/EKS cluster
- Argo CD
Slides: One, Two, Green & Blue; See The Ways Vcluster Can Work For You but the demo in the video or the code described below is really the interesting stuff...
Warning: Thar might be dragons here... I always recommend understanding what you're doing rather than blindly copy/pasting commands...
- If you need to build a Kubernetes cluster, follow this quick-start guide
- Install clusterctl
- Modify
~/.cluster-api/clusterctl.yaml
and add the vcluster providerproviders: - name: vcluster url: https://github.com/loft-sh/cluster-api-provider-vcluster/releases/latest/infrastructure-components.yaml type: InfrastructureProvider
- Make sure your
KUBECONFIG
is pointing to the cluster you want to have Argo CD and the vcluster(s) installed on - Install Argo CD on the cluster
- Initialize cluster-api
clusterctl init --infrastructure vcluster
- Create a namespace to run in
kubectl create ns vcluster
- Fork this repo so you can make modifications and test out the process
- Take the
argocd/applicationset.yaml
and modify to set any helm values as appropriate. e.g., set thebase_domain_name
andingress_class
if you want (I prefer to use some form of ingress overvcluster connect
)- NOTE: If you don't use Contour for your ingress, you'll want to change from
HTTPProxy
to your ingress object of choice for the helm chart. - Be sure to update the
Chart.yaml
with a new version number with each change - Point the
spec.generators.pullRequest.github.owner
&spec.generators.pullRequest.github.repo
to your forked repo - Update the
spec.template.spec.source.repoURL
to your forked repo
- NOTE: If you don't use Contour for your ingress, you'll want to change from
- Apply the
ApplicationSet
by runningkubectl apply -f applicationset.yaml -n argocd
- Create a PR against your forked repo
- Check that a new Argo CD
Application
has been automatically createdkubectl get applications -n argocd
- Check that a new vcluster is being created
kubectl get cluster -n vcluster
by the cluster-api - Get the
KUBECONFIG
for the new vclusterclusterctl get kubeconfig <cluster name from above> --namespace vcluster > kubeconfig.yaml
- Use the new vcluster
export KUBECONFIG="$(pwd)/kubeconfig.yaml"
- Profit!