### Source CAPVultr Config Script (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Commands to make the example configuration script executable and then source it to load the environment variables into the current shell session. ```bash chmod +x scripts/capvultr-config-example.sh source scripts/capvultr-config-example.sh ``` -------------------------------- ### Initializing Cluster API Management Cluster (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Initializes the management cluster by installing the core Cluster API components and the Kubeadm bootstrap and control plane providers using the clusterctl tool. ```bash clusterctl init ``` -------------------------------- ### Deploy Vultr Cloud Controller Manager - Bash Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Applies the latest Vultr Cloud Controller Manager manifest to the cluster using the specified KUBECONFIG. This installs the necessary components for Vultr integration. ```bash KUBECONFIG=capvultr-quickstart.kubeconfig kubectl apply -f https://raw.githubusercontent.com/vultr/vultr-cloud-controller-manager/master/docs/releases/latest.yml ``` -------------------------------- ### Set CAPVultr Environment Variables (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Example bash commands to export environment variables required for configuring the CAPVultr workload cluster, including cluster name, Kubernetes version, machine counts, plan IDs, image ID, region, VPC ID, and SSH key ID. A config example is available in scripts/capvultr-config-example.sh. ```bash export CLUSTER_NAME= export KUBERNETES_VERSION=v1.29.7 export CONTROL_PLANE_MACHINE_COUNT=1 export CONTROL_PLANE_PLANID= export WORKER_MACHINE_COUNT=1 export WORKER_PLANID= export MACHINE_IMAGE= # created in the step above. export REGION= export PLANID= export VPCID= export SSHKEY_ID= ``` -------------------------------- ### Listing Vultr Make Commands (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Displays available make targets related to Vultr builds within the image builder directory by filtering the help output. ```bash make help | grep vultr ``` -------------------------------- ### Listing Vultr Snapshots (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Uses the vultr-cli tool to list all available snapshots in your Vultr account, allowing you to find the ID of the newly built image. ```bash vultr-cli snapshot list ``` -------------------------------- ### Add Vultr API Key Path (YAML) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Reference to the YAML file where the VULTR_API_KEY needs to be added for credentials. ```yaml ../defaults/credentials.yaml ``` -------------------------------- ### Get Cluster API Resources (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Lists the Cluster API resources in the management cluster to check their status. ```bash kubectl get cluster-api ``` -------------------------------- ### Get Cluster API Resources - Bash Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Lists Cluster API resources using the `k get cluster-api` command on the Management Cluster. This helps verify the state and presence of Cluster API objects like Clusters, MachineDeployments, and Machines. ```bash k get cluster-api ``` -------------------------------- ### Cloning Image Builder Repository (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Clones the Kubernetes SIGs image-builder repository from GitHub, which contains the necessary files for building custom machine images. ```bash git clone https://github.com/kubernetes-sigs/image-builder.git ``` -------------------------------- ### Apply Cluster Definition (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Applies the generated `cluster.yaml` file to the management cluster using `kubectl`, creating the necessary Cluster API and infrastructure resources. ```bash kubectl apply -f cluster.yaml ``` -------------------------------- ### Building Vultr Ubuntu 22.04 Image (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Executes the make target to build a Vultr snapshot image based on Ubuntu 22.04 using Packer and Ansible configurations found in the current directory. ```bash make build-vultr-ubuntu-2204 ``` -------------------------------- ### Exporting Vultr API Key (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Sets the VULTR_API_KEY environment variable required for authenticating with the Vultr API. Replace `yourapikey` with your actual Vultr API key. ```bash export VULTR_API_KEY=yourapikey ``` -------------------------------- ### Retrieve Workload Kubeconfig (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Retrieves the Kubeconfig file for the newly created workload cluster using `clusterctl` and saves it to a local file. ```bash clusterctl get kubeconfig capvultr-quickstart > capvultr-quickstart.kubeconfig ``` -------------------------------- ### Get KubeadmControlPlane Status (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Checks the status of the KubeadmControlPlane resource to verify if the first control plane node has been initialized. ```bash kubectl get kubeadmcontrolplane ``` -------------------------------- ### Generate Cluster Definition (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Uses `clusterctl` to generate the Kubernetes cluster definition YAML file based on a template, redirecting the output to `cluster.yaml`. ```bash clusterctl generate cluster capvultr-quickstart --from templates/cluster-template.yaml > cluster.yaml ``` -------------------------------- ### Verify Node Status - Bash Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Checks the status of the cluster nodes using `kubectl get node` with the specified KUBECONFIG. This command is used to confirm that nodes are in the 'Ready' state after CNI and CCM deployment. ```bash KUBECONFIG=capvultr-quickstart.kubeconfig kubectl get node ``` -------------------------------- ### Verify Workload Cluster Nodes (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Uses the retrieved Kubeconfig to list the nodes within the workload cluster and verify their status. ```bash KUBECONFIG=capvultr-quickstart.kubeconfig kubectl get node ``` -------------------------------- ### Update Controller Image Path (YAML) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Reference to the YAML file where the controller image URL needs to be updated for the Vultr provider. ```yaml ../default/manager_image_patch.yaml ``` -------------------------------- ### Generating and Applying Workload Cluster Configuration (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Generates the YAML configuration for a new workload cluster using clusterctl and immediately applies it to the management cluster using kubectl, initiating the workload cluster creation process. Replace `[name]` and `[version]` with your desired cluster name and Kubernetes version. ```bash clusterctl generate cluster [name] --kubernetes-version [version] | kubectl apply -f - ``` -------------------------------- ### Build Installer YAML (Shell) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Builds a single YAML file (`install.yaml`) in the `dist` directory containing all necessary resources for installation without dependencies. Requires specifying the `CONTROLLER_IMAGE` and `tag`. ```Shell make build-installer CONTROLLER_IMAGE=/cluster-api-provider-vultr:tag ``` -------------------------------- ### Changing Directory to Image Builder CAPI (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Changes the current working directory to the `images/capi` subdirectory within the cloned `image-builder` repository, where the Cluster API image build configurations are located. ```bash cd image-builder/images/capi ``` -------------------------------- ### Install Project from YAML Bundle URL (Kubectl) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Installs the project into a Kubernetes cluster by applying the generated installer YAML file directly from a URL using `kubectl apply -f`. ```Kubectl kubectl apply -f https://raw.githubusercontent.com//cluster-api-provider-vultr//dist/install.yaml ``` -------------------------------- ### Creating SSH Key with vultr-cli (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Creates a new SSH key named "cluster-api-key" in your Vultr account using the vultr-cli tool. Replace the key value with your actual public SSH key. ```bash vultr-cli ssh create --name="cluster-api-key" --key="ssh-rsa AAAAB3NzaC1yc...." ``` -------------------------------- ### Create Vultr CCM Secret (Bash) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/getting-started.md Creates a Kubernetes secret named `vultr-ccm` in the `kube-system` namespace of the workload cluster, containing the Vultr API key required for the Cloud Controller Manager. ```bash KUBECONFIG=capvultr-quickstart.kubeconfig kubectl create secret generic vultr-ccm --namespace kube-system --from-literal api-key=$VULTR_API_KEY ``` -------------------------------- ### Basic Cert-manager Deployment (Starlark) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/tilt_modules/cert_manager/README.md This snippet demonstrates the basic usage of the cert-manager extension. It loads the extension and calls the default deployment function, which installs cert-manager into the target cluster and verifies its operation. ```Starlark load('ext://cert_manager', 'deploy_cert_manager') deploy_cert_manager() ``` -------------------------------- ### Install Cluster API Provider CRDs (Shell) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Installs the Custom Resource Definitions (CRDs) required by the Cluster API Provider Vultr into the Kubernetes cluster using the `make install` command. ```Shell make install ``` -------------------------------- ### Uninstall Cluster API Provider CRDs (Shell) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Deletes the Custom Resource Definitions (CRDs) installed by the Cluster API Provider Vultr from the Kubernetes cluster using the `make uninstall` command. ```Shell make uninstall ``` -------------------------------- ### Apply Sample Configurations (Kubectl) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Applies sample configurations from the `config/samples/` directory to create instances of the solution's resources in the cluster using `kubectl apply -k`. ```Kubectl kubectl apply -k config/samples/ ``` -------------------------------- ### Build and Push Controller Image (Shell) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Builds the controller Docker image and pushes it to a specified registry using `make`. Requires `CONTROLLER_IMAGE` and `TAG` variables to be set. ```Shell make docker-build docker-push CONTROLLER_IMAGE=/cluster-api-provider-vultr TAG=v0.0.1 ``` -------------------------------- ### Deploy Cluster API Provider Controller (Shell) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Deploys the Cluster API Provider Vultr controller manager to the Kubernetes cluster using `make deploy`. Requires specifying the `CONTROLLER_IMAGE` and `TAG` of the built image. ```Shell make deploy CONTROLLER_IMAGE=/cluster-api-provider-vultr TAG=v0.0.1 ``` -------------------------------- ### Undeploy Cluster API Provider Controller (Shell) Source: https://github.com/vultr/cluster-api-provider-vultr/blob/main/docs/deployment-with-custom-registry.md Removes the Cluster API Provider Vultr controller deployment from the Kubernetes cluster using the `make undeploy` command. ```Shell make undeploy ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.