Skip to content

mak3r/capi-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capi-demo

CAPI Demo on Rancher Manager using Turtles

Requirements

  • Rancher >=v2.9.x or Rancher Prime >= v3.0 installed
  • Turtles operator installed in Rancher Local Cluster
  • clusterctl is installed
  • clusterawsadm is installed

AWS infra with RKE2 k8s - Steps

Build an AMI

Original docs here: https://github.com/rancher/cluster-api-provider-rke2/blob/main/image-builder/README.md

Prerequisites

  • Hashicorp packer

  • AWS packer plugin

    packer plugins install github.com/hashicorp/amazon

Build AMI

  1. Checkout the https://github.com/rancher/cluster-api-provider-rke2/tree/main project locally
  2. cd into the image-builder directory
  3. edit aws/opensuse-leap-156.json with valid existing AMI
  4. build command uses 156 not 155 (which is in the docs)

Initial setup

  1. Install Rancher Turtles

  2. Source some bash functions for the next steps

    source providers/aws/ready-aws.sh

  3. Prep env variables

    prep_env [your-aws-ssh-key-name]

  4. Setup IAM profile

    clusterawsadm bootstrap iam create-cloudformation-stack

  5. Install the capa-system namespace

    kubectl apply -f providers/aws/ns.yaml

  6. Generate the secret

    generate_secret

  7. Install the Infrastucture provider

    kubectl apply -f providers/aws/InfrastructureProviderAWS.yaml

Create a cluster (requires completion of Initial Setup)

  1. Source some bash functions for the next steps

    source providers/aws/ready-aws.sh

  2. Prep env variables

    • NOTE: Do not include .pem extension of the key name

    prep_env [your-aws-ssh-key-name]

  3. Create a cluster yaml configuration

    • NOTE: These methods create the cluster configuration and apply it with the active kubeconfig.

    create_cluster [cluster-name]

    • OR Create a cluster with a namespace

    create_cluster_in_namespace [cluster-name] [namespace]

  4. Import the cluster(s) into rancher

    import_clusters_in_namespace [namespace]

CAPI UI Extension

  1. Add a repository in Rancher
  • Select radio button: Target: https URL generated by helm
  • Index URL: https://rancher.github.io/capi-ui-extension/
  • Save

Debugging

If things don't go as expected, look at the capa-controller-manager pod logs. From there, hopefully you can work your way through other resources to figure out what is missing/misconfigured/etc.

Additional demo points not yet setup

  • Alternate CAPI infrastructure provider. e.g. Azure, VMWare, etc.
    • value of instances is that the infra provider is agnostic to capi
    • using managed k8s means greater variation in configuration because it involves infra, bootstrap and control plane provider variations.
  • Rancher projects vs Tanzu workspaces (in Rancher Manger or Downstream clusters?)
  • Auto deployment of SUSE Security, RBAC configurations and SUSE Observability
  • Modify downstream cluster volume sizes as part of the initial creation step
  • Use ClusterClass for improved templating demo

Cleanup

  1. for each cluster created kubectl delete -f <cluster_name>.yaml
  2. Remove <cluster>.yaml files from the project.
  3. Remove namespaces created with clusters
  4. Delete the aws secret kubectl delete secret aws-variables -n capa-system

About

CAPI Demo on Rancher Manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages