diff --git a/docs/book/src/tasks/experimental-features/cluster-classes.md b/docs/book/src/tasks/experimental-features/cluster-classes.md index 36fa32dfb613..7ebc681edab5 100644 --- a/docs/book/src/tasks/experimental-features/cluster-classes.md +++ b/docs/book/src/tasks/experimental-features/cluster-classes.md @@ -63,181 +63,50 @@ The below contains six yaml objects which are used to define the cluster: * KubeadmConfigTemplate The ClusterClass - first in the below yaml - contains references to the templates needed to build a full cluster using the shape defined in the ClusterClass. + +The full ClusterClass definition can also be found in the [CAPI repo](https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/book/src/tasks/yamls/clusterclass.yaml). + +
ClusterClass + ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 -kind: ClusterClass -metadata: - name: clusterclass - namespace: default -spec: - controlPlane: - metadata: - ref: - apiVersion: controlplane.cluster.x-k8s.io/v1beta1 - kind: KubeadmControlPlaneTemplate - name: clusterclass-control-plane - namespace: default - machineInfrastructure: - ref: - kind: DockerMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - name: "clusterclass-control-plane" - namespace: default - infrastructure: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerClusterTemplate - name: clusterclass-infrastructure - namespace: default - workers: - machineDeployments: - - class: linux-worker - template: - metadata: - bootstrap: - ref: - kind: KubeadmConfigTemplate - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 - name: "clusterclass-md-1" - infrastructure: - ref: - kind: DockerMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - name: "clusterclass-md-1" - ---- - -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: DockerClusterTemplate -metadata: - name: clusterclass-infrastructure - namespace: default ---- -kind: KubeadmControlPlaneTemplate -apiVersion: controlplane.cluster.x-k8s.io/v1beta1 -metadata: - name: "clusterclass-control-plane" - namespace: default -spec: - template: - spec: - replicas: 1 - machineTemplate: - infrastructureRef: - kind: DockerMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - name: "clusterclass-control-plane" - namespace: default - kubeadmConfigSpec: - clusterConfiguration: - controllerManager: - extraArgs: { enable-hostpath-provisioner: 'true' } - apiServer: - certSANs: [ localhost, 127.0.0.1 ] - initConfiguration: - nodeRegistration: - criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: - cgroup-driver: cgroupfs - eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' - joinConfiguration: - nodeRegistration: - criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: - cgroup-driver: cgroupfs - eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' - version: v1.21.2 ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: DockerMachineTemplate -metadata: - name: "clusterclass-control-plane" - namespace: default -spec: - template: - spec: - extraMounts: - - containerPath: "/var/run/docker.sock" - hostPath: "/var/run/docker.sock" ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: DockerMachineTemplate -metadata: - name: "clusterclass-md-1" - namespace: default -spec: - template: - spec: { } ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 -kind: KubeadmConfigTemplate -metadata: - name: "clusterclass-md-1" - namespace: default -spec: - template: - spec: - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cgroup-driver: cgroupfs - eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' +{{#include ./yamls/clusterclass.yaml}} ``` -The above file can be found in the [CAPI repo](https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/test/infrastructure/docker/examples/clusterclass.yaml). +
+ To create the objects on your local cluster run: ```bash -kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/test/infrastructure/docker/examples/clusterclass.yaml +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/book/src/tasks/yamls/clusterclass.yaml ``` #### Enable networking for workload clusters To make sure workload clusters come up with a functioning network a Kindnet ConfigMap with a Kindnet ClusterResourceSet is required. Kindnet only offers networking for Clusters built with Kind and CAPD. This can be substituted for any other networking solution for Kubernetes e.g. Calico as used in the Quickstart guide. -The kindnet configuration file can be found in the [CAPI repo](https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/test/infrastructure/docker/examples/kindnet-clusterresourceset.yaml). +The kindnet configuration file can be found in the [CAPI repo](https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/book/src/tasks/yamls/clusterclass.yaml). To create the resources run: ```bash -kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/test/infrastructure/docker/examples/kindnet-clusterresourceset.yaml +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/book/src/tasks/yamls/kindnet-clusterresourceset.yaml ``` #### Create the workload cluster -The below is a Cluster definition that leverages the ClusterClass created above to define its shape. +This is a Cluster definition that leverages the ClusterClass created above to define its shape. + +
Cluster ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 -kind: Cluster -metadata: - name: "clusterclass-quickstart" - namespace: default - labels: - cni: kindnet -spec: - clusterNetwork: - services: - cidrBlocks: ["10.128.0.0/12"] - pods: - cidrBlocks: ["192.168.0.0/16"] - serviceDomain: "cluster.local" - topology: - class: clusterclass - version: v1.21.2 - controlPlane: - replicas: 1 - workers: - machineDeployments: - - class: linux-worker - name: linux-workers - replicas: 1 +{{#include ./yamls/clusterclass-quickstart.yaml}} ``` +
-Create the Cluster object from the file in [the CAPI repo](https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/test/infrastructure/docker/examples/clusterclass-quickstart.yaml) with: +Create the Cluster object from the file in [the CAPI repo](https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/book/src/tasks/yamls/clusterclass-quickstart.yaml) with: ```bash -kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/test/infrastructure/docker/examples/clusterclass-quickstart.yaml +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/book/src/tasks/yamls/clusterclass-quickstart.yaml ``` #### Verify the workload cluster is running diff --git a/test/infrastructure/docker/examples/clusterclass-quickstart.yaml b/docs/book/src/tasks/experimental-features/yamls/clusterclass-quickstart.yaml similarity index 100% rename from test/infrastructure/docker/examples/clusterclass-quickstart.yaml rename to docs/book/src/tasks/experimental-features/yamls/clusterclass-quickstart.yaml diff --git a/test/infrastructure/docker/examples/clusterclass.yaml b/docs/book/src/tasks/experimental-features/yamls/clusterclass.yaml similarity index 100% rename from test/infrastructure/docker/examples/clusterclass.yaml rename to docs/book/src/tasks/experimental-features/yamls/clusterclass.yaml diff --git a/test/infrastructure/docker/examples/kindnet-clusterresourceset.yaml b/docs/book/src/tasks/experimental-features/yamls/kindnet-clusterresourceset.yaml similarity index 100% rename from test/infrastructure/docker/examples/kindnet-clusterresourceset.yaml rename to docs/book/src/tasks/experimental-features/yamls/kindnet-clusterresourceset.yaml