### Cluster API Initialization Output Example Source: https://cluster-api.sigs.k8s.io/user/quick-start This is an example output of the `clusterctl init` command, showing the installation of cert-manager and various Cluster API providers. ```text Fetching providers Installing cert-manager Version="v1.11.0" Waiting for cert-manager to be available... Installing Provider="cluster-api" Version="v1.0.0" TargetNamespace="capi-system" Installing Provider="bootstrap-kubeadm" Version="v1.0.0" TargetNamespace="capi-kubeadm-bootstrap-system" Installing Provider="control-plane-kubeadm" Version="v1.0.0" TargetNamespace="capi-kubeadm-control-plane-system" Installing Provider="infrastructure-docker" Version="v1.0.0" TargetNamespace="capd-system" Your management cluster has been initialized successfully! You can now create your first workload cluster by running the following: clusterctl generate cluster [name] --kubernetes-version [version] | kubectl apply -f - ``` -------------------------------- ### Provider Configuration Example Source: https://cluster-api.sigs.k8s.io/clusterctl/developers Example of a `clusterctl-settings.json` file for a specific provider, defining its components file and next version. This is used when adding more providers to your local setup. ```json { "name": "infrastructure-aws", "config": { "componentsFile": "infrastructure-components.yaml", "nextVersion": "v0.5.0" } } ``` -------------------------------- ### Example MachineDeployment Output Source: https://cluster-api.sigs.k8s.io/contributing This is an example output for 'kubectl get machinedeployment', showing the columns for a machine deployment resource. ```bash NAMESPACE NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION quick-start-d5ufye quick-start-ntysk0-md-0 quick-start-ntysk0 1 1 1 ScalingUp 3m28s v1.23.3 ``` -------------------------------- ### Install Kubebuilder on Linux Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/overview Installs kubectl, kustomize, and Kubebuilder on Linux using curl and go. ```bash # Install kubectl KUBECTL_VERSION=$(curl -sfL https://dl.k8s.io/release/stable.txt) curl -fLO https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl # Install kustomize curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash chmod +x ./kustomize && sudo mv ./kustomize /usr/local/bin/kustomize # Install Kubebuilder curl -sLo kubebuilder https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH) chmod +x ./kubebuilder && sudo mv ./kubebuilder /usr/local/bin/kubebuilder ``` -------------------------------- ### Example VSCode Configuration for Envtest Source: https://cluster-api.sigs.k8s.io/developer/core/testing This example configuration integrates VSCode with the envtest framework. It automatically installs necessary executables and configures the environment for testing when the project is opened. ```json { "version": "2.0.0", "tasks": [ { "label": "Install testenv executables", "type": "shell", "command": "./hack/install-test-env.sh", "problemMatcher": [] } ] } ``` ```json { "go.testEnvVars": { "CAPI_TEST_ENV_KUBECONFIG": "${workspaceFolder}/.vscode/testenv.kubeconfig" } } ``` -------------------------------- ### Example KubeadmControlPlane Output Source: https://cluster-api.sigs.k8s.io/contributing This is an example output for 'kubectl get kubeadmcontrolplane', illustrating the columns displayed for a control plane resource. ```bash NAMESPACE NAME INITIALIZED API SERVER AVAILABLE REPLICAS READY UPDATED UNAVAILABLE AGE VERSION quick-start-d5ufye quick-start-ntysk0-control-plane true true 1 1 1 2m44s v1.23.3 ``` -------------------------------- ### KubeadmControlPlane Status Example Source: https://cluster-api.sigs.k8s.io/tasks/experimental-features/ignition An example of the output from 'kubectl get kubeadmcontrolplane', showing the initialized status and version of the control plane. ```text NAME CLUSTER INITIALIZED API SERVER AVAILABLE REPLICAS READY UPDATED UNAVAILABLE AGE VERSION ignition-cluster-control-plane ignition-cluster true 1 1 1 7m7s v1.22.2 ``` -------------------------------- ### Install and Deploy with Make Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/configure-the-deployment Use the 'make install deploy' command to build and deploy the CRDs and manifests directly, which includes the envsubst substitution. ```bash make install deploy ``` -------------------------------- ### Example Controller Deployment Output Source: https://cluster-api.sigs.k8s.io/clusterctl/developers This is an example output showing the status of various Cluster API and cert-manager deployments. It confirms that controllers are running with the expected number of replicas. ```text capd-system capd-controller-manager 1/1 1 1 25m capi-kubeadm-bootstrap-system capi-kubeadm-bootstrap-controller-manager 1/1 1 1 25m capi-kubeadm-control-plane-system capi-kubeadm-control-plane-controller-manager 1/1 1 1 25m capi-system capi-controller-manager 1/1 1 1 25m cert-manager cert-manager 1/1 1 1 27m cert-manager cert-manager-cainjector 1/1 1 1 27m cert-manager cert-manager-webhook 1/1 1 1 27m ``` -------------------------------- ### Install clusterctl on Linux Source: https://cluster-api.sigs.k8s.io/user/quick-start Install the downloaded clusterctl binary to /usr/local/bin for system-wide access. Ensure you have the necessary permissions. ```bash sudo install -o root -g root -m 0755 clusterctl /usr/local/bin/clusterctl ``` -------------------------------- ### KubeadmConfig v1beta1 Example Source: https://cluster-api.sigs.k8s.io/developer/providers/migrations/v1.10-to-v1.11 This example shows the structure of the KubeadmConfig resource in v1beta1, including various configuration options for cluster initialization and joining. ```yaml __apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfig metadata: { ... } spec: bootCommands: [ ... ] clusterConfiguration: apiVersion: "" kind: "" clusterName: "" kubernetesVersion: "" networking: dnsDomain: "" podSubnet: "" serviceSubnet: "" apiServer: certSANs: [ ... ] extraArgs: "v": "5" extraEnvs: [ ... ] extraVolumes: [ ... ] timeoutForControlPlane: "25s" certificatesDir: "" controlPlaneEndpoint: "" controllerManager: extraArgs: "v": "5" extraEnvs: [ ... ] extraVolumes: [ ... ] dns: { ... } etcd: external: { ... } local: dataDir: "" extraArgs: "v": "5" extraEnvs: [ ... ] imageRepository: "" imageTag: "" peerCertSANs: [ ... ] serverCertSANs: [ ... ] featureGates: { ... } imageRepository: "" scheduler: extraArgs: "v": "5" extraEnvs: [ ... ] extraVolumes: [ ... ] diskSetup: { ... } files: [ ... ] format: "" ignition: { ... } initConfiguration: apiVersion: "" kind: "" bootstrapTokens: - description: "" expires: "" groups: [ ... ] token: "" usages: [ ... ] ttl: "45s" localAPIEndpoint: { ... } nodeRegistration: criSocket: "" ignorePreflightErrors: [ ... ] imagePullPolicy: "" imagePullSerial: true kubeletExtraArgs: "v": "5" name: "" taints: [ ... ] patches: { ... } skipPhases: [ ... ] joinConfiguration: apiVersion: "" kind: "" caCertPath: "" controlPlane: { ... } discovery: bootstrapToken: { ... } file: { ... } tlsBootstrapToken: "" timeout: "35s" nodeRegistration: criSocket: "" ignorePreflightErrors: [ ... ] imagePullPolicy: "" imagePullSerial: true kubeletExtraArgs: "v": "5" name: "" taints: [ ... ] patches: { ...} skipPhases: [ ... ] mounts: [ ... ] ntp: { ... } postKubeadmCommands: [ ... ] preKubeadmCommands: [ ... ] useExperimentalRetryJoin: true users: [ ... ] status: conditions: { ... } # clusterv1beta1.Conditions ready: true dataSecretName: "" observedGeneration: 5 v1beta2: conditions: [ ... ] # metav1.Conditions failureMessage: "" failureReason: "" ``` -------------------------------- ### KubeadmConfig v1beta2 Example Source: https://cluster-api.sigs.k8s.io/developer/providers/migrations/v1.10-to-v1.11 This example illustrates the KubeadmConfig resource in v1beta2, showcasing updated fields and structures compared to v1beta1, particularly for extraArgs and timeouts. ```yaml __apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfig metadata: { ... } spec: bootCommands: [ ... ] clusterConfiguration: apiServer: certSANs: [ ... ] extraArgs: - name: "v" value: "5" extraEnvs: [ ... ] extraVolumes: [ ... ] certificatesDir: "" controlPlaneEndpoint: "" controllerManager: extraArgs: - name: "v" value: "5" extraEnvs: [ ... ] extraVolumes: [ ... ] dns: { ... } etcd: external: { ... } local: dataDir: "" extraArgs: - name: "v" value: "5" extraEnvs: [ ... ] imageRepository: "" imageTag: "" peerCertSANs: [ ... ] serverCertSANs: [ ... ] featureGates: { ... } imageRepository: "" certificateValidityPeriodDays: 365 caCertificateValidityPeriodDays: 3650 scheduler: extraArgs: - name: "v" value: "5" extraEnvs: [ ... ] extraVolumes: [ ... ] diskSetup: { ... } files: [ ... ] format: "" ignition: { ... } initConfiguration: bootstrapTokens: - description: "" expires: "" groups: [ ... ] token: "" usages: [ ... ] ttlSeconds: 45 localAPIEndpoint: { ... } nodeRegistration: criSocket: "" ignorePreflightErrors: [ ... ] imagePullPolicy: "" imagePullSerial: true kubeletExtraArgs: - name: "v" value: "5" name: "" taints: [ ... ] patches: { ... } skipPhases: [ ... ] timeouts: controlPlaneComponentHealthCheckSeconds: 25 discoverySeconds: 5 etcdAPICallSeconds: 5 kubeletHealthCheckSeconds: 5 kubernetesAPICallSeconds: 5 tlsBootstrapSeconds: 35 joinConfiguration: caCertPath: "" controlPlane: { ... } discovery: bootstrapToken: { ... } file: { ... } tlsBootstrapToken: "" nodeRegistration: criSocket: "" ignorePreflightErrors: [ ... ] imagePullPolicy: "" imagePullSerial: true kubeletExtraArgs: - name: "v" value: "5" name: "" taints: [ ... ] patches: { ...} skipPhases: [ ... ] timeouts: controlPlaneComponentHealthCheckSeconds: 25 discoverySeconds: 5 etcdAPICallSeconds: 5 kubeletHealthCheckSeconds: 5 kubernetesAPICallSeconds: 5 tlsBootstrapSeconds: 35 mounts: [ ... ] ntp: { ... } postKubeadmCommands: [ ... ] preKubeadmCommands: [ ... ] users: [ ... ] status: ``` -------------------------------- ### Configure Reconcilers and Indexes for envtest Source: https://cluster-api.sigs.k8s.io/developer/core/testing Example of setting up custom reconcilers and indexers within the envtest RunInput. Ensure proper error handling for setup functions. ```go func TestMain(m *testing.M) { // Setup envtest setupReconcilers := func(ctx context.Context, mgr ctrl.Manager) { if err := (&MyReconciler{ Client: mgr.GetClient(), Log: log.NullLogger{}, }).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil { panic(fmt.Sprintf("Failed to start the MyReconciler: %v", err)) } } setupIndexes := func(ctx context.Context, mgr ctrl.Manager) { if err := index.AddDefaultIndexes(ctx, mgr); err != nil { panic(fmt.Sprintf("unable to setup index: %v", err)) } // Run tests ... } ``` -------------------------------- ### Initialize Management Cluster with vcluster Source: https://cluster-api.sigs.k8s.io/user/quick-start Initializes the management cluster using the vcluster infrastructure provider. Refer to the Cluster API Provider for vcluster Quick Start Guide for detailed instructions. ```bash clusterctl init --infrastructure vcluster ``` -------------------------------- ### BootstrapConfig Status Example Source: https://cluster-api.sigs.k8s.io/developer/core/controllers/machine-pool This example shows the required status fields for a BootstrapConfig object, including 'ready' and 'dataSecretName'. ```yaml kind: MyBootstrapProviderConfig apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 status: ready: true dataSecretName: "MyBootstrapSecret" ``` -------------------------------- ### Example Provider Pod Conditions Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/building-running-and-testing An example output showing the conditions for a deployed provider's system pod. Similar to the manager pod, all conditions should be 'True'. ```yaml Conditions: Type Status PodReadyToStartContainers True Initialized True Ready True ContainersReady True ``` -------------------------------- ### Start Development Environment with Tilt Source: https://cluster-api.sigs.k8s.io/developer/core/tilt Run this command to launch your development environment using Tilt, which includes starting the command-line HUD and a web browser interface. ```bash make tilt-up ``` -------------------------------- ### Example Kube-System Pods Running Status Source: https://cluster-api.sigs.k8s.io/user/quick-start An example output showing all pods in the kube-system namespace in a 'Running' status, indicating a healthy cluster initialization. ```text NAME READY STATUS RESTARTS AGE calico-kube-controllers-c969cf844-dgld6 1/1 Running 0 50s calico-node-7zz7c 1/1 Running 0 54s calico-node-jmjd6 1/1 Running 0 54s coredns-64897985d-dspjm 1/1 Running 0 3m49s coredns-64897985d-pgtgz 1/1 Running 0 3m49s etcd-capi-quickstart-control-plane-kjjbb 1/1 Running 0 3m57s kube-apiserver-capi-quickstart-control-plane-kjjbb 1/1 Running 0 3m57s kube-controller-manager-capi-quickstart-control-plane-kjjbb 1/1 Running 0 3m57s kube-proxy-b9g5m 1/1 Running 0 3m12s kube-proxy-p6xx8 1/1 Running 0 3m49s kube-scheduler-capi-quickstart-control-plane-kjjbb 1/1 Running 0 3m57s ``` -------------------------------- ### Start Tilt Development Environment Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/building-running-and-testing Command to start the Tilt development environment for Cluster API. This command ensures Tilt is set up correctly, potentially using a local registry. ```bash cd cluster-api make tilt-up ``` -------------------------------- ### Example Manager Pod Conditions Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/building-running-and-testing An example output showing the conditions for a running Cluster API manager pod. All conditions should be 'True' for proper operation. ```yaml Conditions: Type Status PodReadyToStartContainers True Initialized True Ready True ContainersReady True ``` -------------------------------- ### Initialize Management Cluster with Cloud Director Source: https://cluster-api.sigs.k8s.io/user/quick-start Initializes the management cluster using the VMware Cloud Director infrastructure provider. Follow the Cluster API Provider for Cloud Director Getting Started Guide for setup. ```bash clusterctl init --infrastructure vcd ``` -------------------------------- ### Metal3 Environment Variables Source: https://cluster-api.sigs.k8s.io/user/quick-start Configure Metal3 environment variables for partition, project ID, control plane IP, and machine images/sizes. Visit the Metal3 getting started guide for more details. ```bash export METAL_PARTITION= export METAL_PROJECT_ID= export CONTROL_PLANE_IP= ``` ```bash export FIREWALL_MACHINE_IMAGE= export FIREWALL_MACHINE_SIZE= ``` ```bash export CONTROL_PLANE_MACHINE_IMAGE= export CONTROL_PLANE_MACHINE_SIZE= export WORKER_MACHINE_IMAGE= export WORKER_MACHINE_SIZE= ``` -------------------------------- ### Initialize Project Directory and Git Repository Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/initialize-repo-and-api-types Create a new directory for your provider and initialize it as a Git repository. This is the first step in setting up your project structure. ```bash mkdir -p src/sigs.k8s.io/cluster-api-provider-mailgun cd src/sigs.k8s.io/cluster-api-provider-mailgun git init ``` -------------------------------- ### Initialize Go Modules Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/initialize-repo-and-api-types Set up Go modules for your project to manage dependencies. Replace 'github.com/liztio/cluster-api-provider-mailgun' with your actual module path. ```bash go mod init github.com/liztio/cluster-api-provider-mailgun ``` -------------------------------- ### Example Plugin Script Source: https://cluster-api.sigs.k8s.io/clusterctl/plugins A bash script demonstrating a basic clusterctl plugin. It handles 'version' and 'example-env-var' arguments and prints its name otherwise. Environment variables are accessible. ```bash #!/bin/bash # optional argument handling if [[ "$1" == "version" ]] then echo "1.0.0" exit 0 fi # optional argument handling if [[ "$1" == "example-env-var" ]] then echo "$EXAMPLE_ENV_VAR" exit 0 fi echo "I am a plugin named clusterctl-foo" ``` -------------------------------- ### Initialize and Run envtest Source: https://cluster-api.sigs.k8s.io/developer/core/testing Set up and run the envtest environment, configuring reconcilers and indexes. This code should typically reside in a `suite_test.go` file. ```go var ( env *envtest.Environment ctx = ctrl.SetupSignalHandler() ) func TestMain(m *testing.M) { // Setup envtest ... // Run tests os.Exit(envtest.Run(ctx, envtest.RunInput{ M: m, SetupEnv: func(e *envtest.Environment) { env = e }, SetupIndexes: setupIndexes, SetupReconcilers: setupReconcilers, })) } ``` -------------------------------- ### Build, Push, and Apply Manifests Source: https://cluster-api.sigs.k8s.io/developer/getting-started This sequence of commands builds Docker images, pushes them to a registry, and then applies the necessary manifests using kustomize and envsubst. This is typically done for iterating on the cluster API. ```bash # Build all the images make docker-build # Push images make docker-push # Apply the manifests kustomize build config/default | ./hack/tools/bin/envsubst | kubectl apply -f - kustomize build bootstrap/kubeadm/config/default | ./hack/tools/bin/envsubst | kubectl apply -f - kustomize build controlplane/kubeadm/config/default | ./hack/tools/bin/envsubst | kubectl apply -f - kustomize build test/infrastructure/docker/config/default | ./hack/tools/bin/envsubst | kubectl apply -f - ``` -------------------------------- ### Invoke Plugin Command Source: https://cluster-api.sigs.k8s.io/clusterctl/plugins Example of invoking the installed plugin as a clusterctl subcommand. ```bash clusterctl foo ``` -------------------------------- ### KubeletConfiguration via KubeadmConfigSpec.files Source: https://cluster-api.sigs.k8s.io/tasks/bootstrap/kubeadm-bootstrap/kubelet-config This example demonstrates how to provide a custom KubeletConfiguration file to nodes using `KubeadmConfigSpec.files`. The `kubeletExtraArgs` in both `initConfiguration` and `joinConfiguration` are then set to point to this file, ensuring kubelet uses the specified configuration. ```yaml apiVersion: controlplane.cluster.x-k8s.io/v1beta2 kind: KubeadmControlPlaneTemplate metadata: name: cloudinit-control-plane namespace: default spec: template: spec: kubeadmConfigSpec: files: # We put a KubeletConfiguration file on nodes via KubeadmConfigSpec.files # In this example, we directly put the file content in the KubeadmConfigSpec.files.content field. - path: /etc/kubernetes/kubelet/config.yaml owner: "root:root" permissions: "0644" content: | apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration kubeReserved: cpu: "1" memory: "2Gi" ephemeral-storage: "1Gi" systemReserved: cpu: "500m" memory: "1Gi" ephemeral-storage: "1Gi" evictionHard: memory.available: "500Mi" nodefs.available: "10%" authentication: anonymous: enabled: false webhook: cacheTTL: 0s enabled: true x509: clientCAFile: /etc/kubernetes/pki/ca.crt authorization: mode: Webhook webhook: cacheAuthorizedTTL: 0s cacheUnauthorizedTTL: 0s cgroupDriver: systemd clusterDNS: - 10.128.0.10 clusterDomain: cluster.local containerRuntimeEndpoint: "" cpuManagerReconcilePeriod: 0s evictionPressureTransitionPeriod: 0s fileCheckFrequency: 0s healthzBindAddress: 127.0.0.1 healthzPort: 10248 httpCheckFrequency: 0s imageMinimumGCAge: 0s logging: flushFrequency: 0 options: json: infoBufferSize: "0" verbosity: 0 memorySwap: {} nodeStatusReportFrequency: 0s nodeStatusUpdateFrequency: 0s rotateCertificates: true runtimeRequestTimeout: 0s shutdownGracePeriod: 0s shutdownGracePeriodCriticalPods: 0s staticPodPath: /etc/kubernetes/manifests streamingConnectionIdleTimeout: 0s syncFrequency: 0s volumeStatsAggPeriod: 0s initConfiguration: nodeRegistration: criSocket: unix:///var/run/containerd/containerd.sock # Here we configure kubelet to use the KubeletConfiguration file we put on nodes via KubeadmConfigSpec.files kubeletExtraArgs: - name: config value: "/etc/kubernetes/kubelet/config.yaml" joinConfiguration: nodeRegistration: criSocket: unix:///var/run/containerd/containerd.sock # Here we configure kubelet to use the KubeletConfiguration file we put on nodes via KubeadmConfigSpec.files kubeletExtraArgs: - name: config value: "/etc/kubernetes/kubelet/config.yaml" ``` -------------------------------- ### Get Kubeconfig for a Workload Cluster Source: https://cluster-api.sigs.k8s.io/clusterctl/commands/get-kubeconfig Use this command to retrieve the kubeconfig for a workload cluster named 'foo'. Ensure you have clusterctl version 0.3.9 or newer installed. ```bash clusterctl get kubeconfig foo ``` -------------------------------- ### DiskSetup Source: https://cluster-api.sigs.k8s.io/reference/api/crd-api-reference DiskSetup defines input for generated disk_setup and fs_setup in cloud-init. It specifies partitions and filesystems to set up. ```APIDOC ## DiskSetup ### Description DiskSetup defines input for generated disk_setup and fs_setup in cloud-init. ### Fields - `partitions` (Partition array) - Optional - partitions specifies the list of the partitions to setup. (Validation: ExactlyOneOf: [layout diskLayout], MaxItems: 100) - `filesystems` (Filesystem array) - Optional - filesystems specifies the list of file systems to setup. (Validation: MaxItems: 100) ``` -------------------------------- ### Define Tilt Provider Configuration Source: https://cluster-api.sigs.k8s.io/developer/core/tilt Example `tilt-provider.yaml` file specifying how to build a provider, including its image, live reload dependencies, and label. ```yaml name: aws config: image: "gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller" live_reload_deps: ["main.go", "go.mod", "go.sum", "api", "cmd", "controllers", "pkg"] label: CAPA ``` -------------------------------- ### Initialize Management Cluster with Kubekey Infrastructure Source: https://cluster-api.sigs.k8s.io/user/quick-start Initializes the management cluster using the Kubekey infrastructure provider. ```bash # Initialize the management cluster clusterctl init --infrastructure kubekey ``` -------------------------------- ### Install cert-manager with Helm Source: https://cluster-api.sigs.k8s.io/user/quick-start-operator Installs cert-manager using Helm, ensuring CRDs are installed. This is a prerequisite for Cluster API Operator. ```bash helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true ``` -------------------------------- ### Install clusterctl with Homebrew Source: https://cluster-api.sigs.k8s.io/user/quick-start Install the clusterctl CLI tool using Homebrew for macOS. ```bash brew install clusterctl ``` -------------------------------- ### Install Kubebuilder on macOS Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/overview Installs kubectl, kustomize, and Kubebuilder using Homebrew on macOS. ```bash # Install kubectl brew install kubernetes-cli # Install kustomize brew install kustomize # Install Kubebuilder brew install kubebuilder ``` -------------------------------- ### Configure KubeKey Instance and Network Settings Source: https://cluster-api.sigs.k8s.io/user/quick-start Set environment variables for KubeKey binary download zone, SSH user credentials, instance IP addresses, and control plane VIP. ```bash # Required environment variables # The KKZONE is used to specify where to download the binaries. (e.g. "", "cn") export KKZONE="" # The ssh name of the all instance Linux user. (e.g. root, ubuntu) export USER_NAME= # The ssh password of the all instance Linux user. export PASSWORD= # The ssh IP address of the all instance. (e.g. "[{address: 192.168.100.3}, {address: 192.168.100.4}]") export INSTANCES= # The cluster control plane VIP. (e.g. "192.168.100.100") export CONTROL_PLANE_ENDPOINT_IP= ``` -------------------------------- ### Install clusterawsadm with Homebrew Source: https://cluster-api.sigs.k8s.io/user/quick-start Installs the clusterawsadm utility on macOS using the Homebrew package manager. ```bash brew install clusterawsadm ``` -------------------------------- ### Initialize Management Cluster with Outscale Infrastructure Source: https://cluster-api.sigs.k8s.io/user/quick-start Sets Outscale credentials and region, creates a namespace and secret for the provider, then initializes the management cluster. ```bash export OSC_SECRET_KEY= export OSC_ACCESS_KEY= export OSC_REGION= # Create namespace kubectl create namespace cluster-api-provider-outscale-system # Create secret kubectl create secret generic cluster-api-provider-outscale --from-literal=access_key=${OSC_ACCESS_KEY} --from-literal=secret_key=${OSC_SECRET_KEY} --from-literal=region=${OSC_REGION} -n cluster-api-provider-outscale-system # Initialize the management cluster clusterctl init --infrastructure outscale ``` -------------------------------- ### DiscoverVariablesRequest Example Source: https://cluster-api.sigs.k8s.io/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook This is an example of a DiscoverVariablesRequest sent to a runtime hook. It includes settings for the runtime extension. ```yaml __ apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1 kind: DiscoverVariablesRequest settings: ``` -------------------------------- ### Plugin Output Example Source: https://cluster-api.sigs.k8s.io/clusterctl/plugins The expected output when the 'clusterctl foo' command is executed. ```text I am a plugin named clusterctl-foo ``` -------------------------------- ### Verify clusterctl Version on Linux Source: https://cluster-api.sigs.k8s.io/user/quick-start Check the installed version of clusterctl to ensure it is up-to-date and correctly installed. ```bash clusterctl version ``` -------------------------------- ### MachineDeployment CRD v1beta2 Example Source: https://cluster-api.sigs.k8s.io/developer/providers/migrations/v1.10-to-v1.11 This is an example of the MachineDeployment CRD in v1beta2, reflecting the changes introduced in v1.11. ```yaml __apiVersion: cluster.x-k8s.io/v1beta2 kind: MachineDeployment metadata: { ... } spec: paused: true clusterName: "" selector: { ... } machineNaming: template: "" replicas: 5 template: metadata: { ... } spec: clusterName: "" failureDomain: "" version: "" readinessGates: [ ... ] bootstrap: configRef: apiGroup: "" kind: "" name: "" dataSecretName: "" infrastructureRef: apiGroup: "" kind: "" name: "" deletion: nodeDeletionTimeoutSeconds: 10 nodeDrainTimeoutSeconds: 20 nodeVolumeDetachTimeoutSeconds: 30 providerID: "" minReadySeconds: 15 rollout: after: "2030-07-23T10:56:54Z" strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 deletion: order: Oldest remediation: maxInFlight: 3 status: conditions: [ ... ] # metav1.Conditions observedGeneration: 5 phase: "" selector: "" replicas: 5 availableReplicas: 1 readyReplicas: 2 upToDateReplicas: 3 deprecated: v1beta1: conditions: { ... } # clusterv1beta1.Conditions availableReplicas: 11 readyReplicas: 12 unavailableReplicas: 13 updatedReplicas: 14 ``` -------------------------------- ### Initialize Management Cluster with K0s Project Infrastructure Source: https://cluster-api.sigs.k8s.io/user/quick-start Initializes the management cluster using the K0s Project (k0smotron) infrastructure provider. ```bash # Initialize the management cluster clusterctl init --infrastructure k0sproject-k0smotron ``` -------------------------------- ### MachineDeployment CRD v1beta1 Example Source: https://cluster-api.sigs.k8s.io/developer/providers/migrations/v1.10-to-v1.11 This is an example of the MachineDeployment CRD in v1beta1, illustrating the structure before the v1.11 changes. ```yaml __apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: { ... } spec: paused: true clusterName: "" selector: { ... } progressDeadlineSeconds: 5 revisionHistoryLimit: 5 machineNamingStrategy: template: "" replicas: 5 template: metadata: { ... } spec: clusterName: "" failureDomain: "" version: "" readinessGates: [ ... ] bootstrap: configRef: apiVersion: "" kind: "" name: "" namespace: "" # and also fieldPath, resourceVersion, uid dataSecretName: "" infrastructureRef: apiVersion: "" kind: "" name: "" namespace: "" # and also fieldPath, resourceVersion, uid nodeDeletionTimeout: 10s nodeDrainTimeout: 20s nodeVolumeDetachTimeout: 30s providerID: "" minReadySeconds: 15 rolloutAfter: "2030-07-23T10:56:54Z" strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 deletePolicy: Oldest remediation: maxInFlight: 3 status: conditions: { ... } # clusterv1beta1.Conditions observedGeneration: 5 phase: "" selector: "" replicas: 5 availableReplicas: 11 readyReplicas: 12 unavailableReplicas: 13 updatedReplicas: 14 v1beta2: conditions: [ ... ] # metav1.Conditions availableReplicas: 1 readyReplicas: 2 upToDateReplicas: 3 ``` -------------------------------- ### Configure Disk Setup with KubeadmConfig Source: https://cluster-api.sigs.k8s.io/tasks/bootstrap/kubeadm-bootstrap Use KubeadmConfig.DiskSetup to define partition tables and file systems on devices. Supports specifying filesystem type, label, and existing partition replacements. ```yaml __ diskSetup: filesystems: - device: /dev/disk/azure/scsi1/lun0 extraOpts: - -E - lazy_itable_init=1,lazy_journal_init=1 filesystem: ext4 label: etcd_disk - device: ephemeral0.1 filesystem: ext4 label: ephemeral0 replaceFS: ntfs partitions: - device: /dev/disk/azure/scsi1/lun0 layout: true overwrite: false tableType: gpt ``` -------------------------------- ### Install Cluster API Operator with Docker Provider Source: https://cluster-api.sigs.k8s.io/user/quick-start-operator Installs the Cluster API Operator using Helm, enabling the Docker infrastructure provider. The `--wait` flag is required for the installation to succeed. The `--timeout` flag is optional. ```bash helm install capi-operator capi-operator/cluster-api-operator --create-namespace -n capi-operator-system --set infrastructure.docker.enabled=true --set configSecret.name=${CREDENTIALS_SECRET_NAME} --set configSecret.namespace=${CREDENTIALS_SECRET_NAMESPACE} --wait --timeout 90s ``` -------------------------------- ### Verify clusterctl Version on Windows Source: https://cluster-api.sigs.k8s.io/user/quick-start Check the installed version of clusterctl to ensure it is up-to-date and correctly installed on Windows. ```powershell clusterctl.exe version ``` -------------------------------- ### Build Deployment YAML with Kustomize Source: https://cluster-api.sigs.k8s.io/developer/providers/getting-started/configure-the-deployment Use 'kustomize build' to generate the deployment YAML files from your configuration. ```bash kustomize build config/default ``` -------------------------------- ### AfterControlPlaneInitialized Hook Response Example Source: https://cluster-api.sigs.k8s.io/tasks/experimental-features/runtime-sdk/implement-lifecycle-hooks This is an example of a response payload for the AfterControlPlaneInitialized hook. It signals the status of the hook execution. ```yaml apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1 kind: AfterControlPlaneInitializedResponse status: Success # or Failure message: "error message if status == Failure" ``` -------------------------------- ### GenerateUpgradePlanResponse Example (Success) Source: https://cluster-api.sigs.k8s.io/tasks/experimental-features/runtime-sdk/implement-upgrade-plan-hooks An example of a successful response from the GenerateUpgradePlan hook, specifying control plane upgrade versions. ```yaml __ apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1 kind: GenerateUpgradePlanResponse status: Success # or Failure message: "error message if status == Failure" controlPlaneUpgrades: - version: v1.30.0 - version: v1.31.0 - version: v1.32.3 - version: v1.33.0 ``` -------------------------------- ### Set up Azure Service Principal for Tilt Source: https://cluster-api.sigs.k8s.io/developer/core/tilt Steps to create and configure an Azure Service Principal, including setting subscription, tenant, client ID, and client secret. The output is formatted for tilt-settings.yaml. ```bash __ AZURE_SUBSCRIPTION_ID=$(az account show --query id --output tsv) az account set --subscription $AZURE_SUBSCRIPTION_ID ``` ```bash __ AZURE_SERVICE_PRINCIPAL_NAME=ServicePrincipalName ``` ```bash __ AZURE_TENANT_ID=$(az account show --query tenantId --output tsv) AZURE_CLIENT_SECRET=$(az ad sp create-for-rbac --name http://$AZURE_SERVICE_PRINCIPAL_NAME --query password --output tsv) AZURE_CLIENT_ID=$(az ad sp show --id http://$AZURE_SERVICE_PRINCIPAL_NAME --query appId --output tsv) ``` ```bash __ cat <