Skip to content

Commit

Permalink
moved yamls and added collapsable details panels
Browse files Browse the repository at this point in the history
  • Loading branch information
killianmuldoon committed Oct 5, 2021
1 parent 2146bfd commit 0ed4033
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 149 deletions.
167 changes: 18 additions & 149 deletions docs/book/src/tasks/experimental-features/cluster-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

<details><summary>ClusterClass</summary>

```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).
</details>


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.

<details><summary>Cluster</summary>

```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}}
```
</details>

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
Expand Down

0 comments on commit 0ed4033

Please sign in to comment.