|
1 | | -# Bring your own host enhancement design |
2 | | - |
3 | | - |
| 1 | +# Bring-Your-Own-Host Design |
4 | 2 |
|
5 | 3 | ## Abstract |
6 | 4 |
|
7 | | -The Bring Your Own Host aka BYOH aims at enabling Kubernetes cluster life cycle management on user provided hosts (most of the case are bare metal hosts) with TKGm/TMC |
| 5 | +The Bring Your Own Host aka BYOH aims at enabling Kubernetes cluster life cycle management on user provided hosts (bare metal hosts in most cases). |
8 | 6 |
|
9 | | -But currently only 1 infrastructure provider is supported in tanzu-framework, this is to enhance current tanzu-framework so that users can use tanzu CLI to create BYOH workload cluster. |
| 7 | +Currently some infrastructure providers are supported in tanzu-framework(e.g. vSphere, AWS, Azure). This is to enhance current tanzu-framework to support BYOH as infrastructure provider, so that users can use tanzu CLI to create BYOH workload cluster. |
10 | 8 |
|
11 | 9 | ## Background |
12 | 10 |
|
13 | | -Consider the multiple provider work covers multiple components in Tanzu product family and from BYOH team's point of view we are searching to enable customer to be able to create BYOH cluster with Tanzu cli as a start point. We shape the project into 3 phases and firstly we intend to implement the "crawl phase": |
| 11 | +Consider the multiple provider work covers multiple components in Tanzu product family and from BYOH team's point of view we are searching to enable customer to be able to create BYOH workload cluster with Tanzu CLI as a start point. We shape the project into 3 phases and firstly we intend to implement the "crawl phase": |
14 | 12 |
|
15 | 13 | Crawl Phase |
16 | 14 |
|
17 | | -1. Enhance the tanzu cluster create cli so customer can use it be able to create BYOH cluster. |
18 | | -2. Document on patch the existing Management cluster with BYOH provider |
19 | | - |
20 | | -Walk Phase |
21 | | -1. Implement the tanzu management-cluster provider cli so customer can use it patch management cluster with new provider |
22 | | -• Support patching BYOH provider |
23 | | -2. Support install BYOH provider when create management cluster with Tanzu management-cluster create cli or bootstrap UI. |
24 | | -3. Support list/view BYOH workload cluster in TMC UI |
25 | | - |
26 | | -Run Phase |
27 | | -1. Support create BYOH cluster in TMC UI |
28 | | -2. Support lifecycle management of AWS/Azure/Any other provider with tanzu management-cluster provider cli |
29 | | -3. Support create Workload cluster with selected provider with multiple providers installed management cluster in TMC |
30 | | -4. Support creates management cluster directly on BYOH hosts. |
| 15 | +1. Document on patch the existing Management cluster with BYOH provider |
31 | 16 |
|
32 | | -## Goals |
| 17 | +2.Enhance the ```tanzu cluster create``` CLI so customer can use it to create BYOH cluster. |
33 | 18 |
|
34 | | -* Define the configurations used for BYOH to create BYOH workload cluster. |
35 | | -* Use the existing Tanzu cluster create command to create BYOH workload cluster using the configuration file. |
36 | | -* Use the existing Tanzu cluster list/delete/scale command to list/delete/update BYOH workload cluster. |
37 | | - |
38 | | -## Non Goals |
| 19 | +Walk Phase |
39 | 20 |
|
40 | | -* Any changes for TMC UI to support bringyourownhost provider |
| 21 | +1. Implement the tanzu management-cluster provider CLI so customer can use it to patch management cluster with new provider |
41 | 22 |
|
42 | | -## High-Level Design |
| 23 | +2. Support patching BYOH provider |
43 | 24 |
|
44 | | -This is to descirbe what will be targeted for the first phase. |
| 25 | +3. Support install BYOH provider when create management cluster with ```tanzu management-cluster create``` CLI. |
45 | 26 |
|
46 | | -Add the “**infrastructure-byoh**” folder which contains the YTT templates to generate the YAML files, so that CAPI can provision BYOH workload clusters using these YAML files. |
| 27 | +Run Phase |
47 | 28 |
|
48 | | -Add the configuration item to let users define control plane endpoint for BYOH workload cluster. |
| 29 | +1. Support lifecycle management of AWS/Azure/Any other provider with ```tanzu management-cluster provider``` CLI |
| 30 | + |
| 31 | +2. Support create workload cluster with selected provider with multiple providers installed management cluster. |
| 32 | + |
| 33 | +3. Support creates management cluster directly on BYOH hosts. |
49 | 34 |
|
50 | | -Update BOM files to support BYOH. |
| 35 | +## Goals |
51 | 36 |
|
52 | | -Update the logic to validate the configurations for provisioning BYOH clusters. |
| 37 | +* Define the configurations used for BYOH to create BYOH workload cluster. |
| 38 | +* Use the existing ```tanzu cluster create``` command to create BYOH workload cluster using the configuration file. |
| 39 | +* Use the existing ```tanzu cluster list/delete/scale``` command to list/delete/update BYOH workload cluster. |
53 | 40 |
|
| 41 | +## High-Level Design |
54 | 42 |
|
| 43 | +This is to describe what will be targeted for the first phase. |
| 44 | + |
| 45 | +### Management cluster |
| 46 | + |
| 47 | +To deploy a management cluster with BYOH integrated, firstly you create a command vSphere management cluster. |
| 48 | +Then you patch the management cluster to have the 'byoh' provider included. |
| 49 | + |
| 50 | +1. Using the ```tanzu management-cluster create``` command to create a common management cluster. |
| 51 | + |
| 52 | +2. Install the "clusterctl" binary and use it to patch the management cluster created by step 1. |
| 53 | + clusterctl, which can be downloaded from the latest [release][releases] of Cluster API (CAPI) on GitHub. |
| 54 | + To learn more about cluster API in more depth, check out the the [Cluster API book][cluster-api-book]. |
| 55 | + |
| 56 | +3. Configuring and installing BringYourOwnHost provider in a management cluster |
| 57 | + To initialize Cluster API Provider BringYourOwnHost, clusterctl requires the following settings, which should be set in `~/.cluster-api/clusterctl.yaml` as the following: |
| 58 | + |
| 59 | +``` yaml |
| 60 | +providers: |
| 61 | + - name: byoh |
| 62 | + url: https://github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/releases/latest/infrastructure-components.yaml |
| 63 | + type: InfrastructureProvider |
| 64 | +``` |
| 65 | +
|
| 66 | +running `clusterctl config repositories`. |
| 67 | + |
| 68 | +You should be able to see the new BYOH provider there. |
| 69 | + |
| 70 | +```shell |
| 71 | +clusterctl config repositories |
| 72 | +NAME TYPE URL FILE |
| 73 | +cluster-api CoreProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ core-components.yaml |
| 74 | +... |
| 75 | +byoh InfrastructureProvider https://github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/releases/latest/ infrastructure-components.yaml |
| 76 | +... |
| 77 | +vsphere InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/latest/ infrastructure-components.yaml |
| 78 | +``` |
| 79 | + |
| 80 | +Install the BYOH provider |
| 81 | + |
| 82 | +```shell |
| 83 | +clusterctl init --infrastructure byoh |
| 84 | +``` |
| 85 | + |
| 86 | +### Workload cluster |
| 87 | + |
| 88 | +To deploy a Kubernetes workload cluster, you create a configuration file that specifies the different options with which to deploy the cluster. You then run the tanzu cluster create command, specifying the configuration file in the ```--file``` option. |
| 89 | +When you deploy a Kubernetes cluster, most of the configuration for the cluster is the same as the configuration of the management cluster that you use to deploy it. |
| 90 | + |
| 91 | +1. Specify the type of infrastructure provider to "BringYourOwnHost" with ```INFRASTRUCTURE_PROVIDER``` variable. |
| 92 | + ```INFRASTRUCTURE_PROVIDER: byoh``` |
| 93 | + |
| 94 | +2. Set a name for the cluster in the ```CLUSTER_NAME``` variable. |
| 95 | +For example if you are deploying the BYOH cluster, set the name to "my-byoh-tkc" |
| 96 | + ```CLUSTER_NAME: my-byoh-tkc``` |
| 97 | + |
| 98 | +3. If you are deploying the cluster to BYOH, specify a static virtual IP address or FQDN in the ```BYOH_CONTROL_PLANE_ENDPOINT``` variable. |
| 99 | + Specify a port in the "BYOH_CONTROL_PLANE_ENDPOINT_PORT" variable. (If not specified, by default the port is: 6443) |
| 100 | + ```BYOH_CONTROL_PLANE_ENDPOINT: 10.90.110.100``` |
| 101 | + ```BYOH_CONTROL_PLANE_ENDPOINT_PORT: 6443``` |
| 102 | + |
| 103 | +4. You can also deploy a BYOH workload cluster with Custom Control Plane and Worker Node Counts. |
| 104 | +In this version, the dev and prod plans for Tanzu Kubernetes clusters deploy the following: |
| 105 | +The dev plan: one control plane node and one worker node. |
| 106 | +The prod plan: three control plane nodes and three worker nodes. |
| 107 | + To deploy a Tanzu Kubernetes cluster with more control plane nodes than the dev and prod plans define by default, specify the ```CONTROL_PLANE_MACHINE_COUNT``` variable in the cluster configuration file. The number of control plane nodes that you specify in ```CONTROL_PLANE_MACHINE_COUNT``` must be uneven: |
| 108 | + ```CONTROL_PLANE_MACHINE_COUNT: 5``` |
| 109 | + Specify the number of worker nodes for the cluster in the WORKER_MACHINE_COUNT variable. For example: |
| 110 | + ```WORKER_MACHINE_COUNT: 5``` |
| 111 | + |
| 112 | +5. Finally, you get a configuration file below, then save the configuration file as "my-byoh-tkc.yaml". |
| 113 | + |
| 114 | + ```yaml |
| 115 | + CLUSTER_CIDR: 100.96.1.0/11 |
| 116 | + CLUSTER_NAME: my-byoh-tkc |
| 117 | + CLUSTER_PLAN: prod |
| 118 | + INFRASTRUCTURE_PROVIDER: byoh |
| 119 | + SERVICE_CIDR: 10.192.168.0/24 |
| 120 | + BYOH_CONTROL_PLANE_ENDPOINT: 10.90.110.100 |
| 121 | + BYOH_CONTROL_PLANE_ENDPOINT_PORT: 6443 |
| 122 | + WORKER_MACHINE_COUNT: 5 |
| 123 | + CONTROL_PLANE_MACHINE_COUNT: 5 |
| 124 | + ``` |
| 125 | + |
| 126 | +6. Run the ```tanzu cluster create``` command, specifying the path to the configuration file in the ```--file``` option. |
| 127 | + ```tanzu cluster create --file ./my-byoh-tkc.yaml``` |
| 128 | + |
| 129 | +7. To see information about the cluster, run the ```tanzu cluster get``` command, specifying the cluster name. |
| 130 | + ```tanzu cluster get my-byoh-tkc``` |
| 131 | + |
| 132 | +8. You can also scale a cluster horizontally with the Tanzu CLI. To horizontally scale a Tanzu Kubernetes cluster, use the ```tanzu cluster scale``` command. You change the number of control plane nodes by specifying the ```--controlplane-machine-count``` option. You change the number of worker nodes by specifying the ```--worker-machine-count``` option. |
| 133 | + To scale a cluster that you originally deployed with 3 control plane nodes and 5 worker nodes to 7 and 10 nodes respectively, run the following command: |
| 134 | +```tanzu cluster scale <cluster_name> --controlplane-machine-count 7 --worker-machine-count 10``` |
55 | 135 |
|
56 | 136 | ## Detailed Design |
57 | 137 |
|
| 138 | +1. Add the “**infrastructure-byoh**” folder which contains the YTT templates to generate the YAML files, so that CAPI can provision BYOH workload clusters using these YAML files. |
58 | 139 | Update "pkg/v1/providers/config.yaml" and create new YTT under folder " pkg/v1/providers/infrastructure-byoh/v0.1.0/" to support BYOH as a new type of provider. |
59 | 140 |
|
| 141 | +2. Add the configuration item to let users define control plane endpoint for BYOH workload cluster. |
60 | 142 | Update "pkg/v1/providers/config_default.yaml" and tanzu-framework go code, so that new configurations can be read to create BYOH workload cluster. |
61 | 143 |
|
62 | | -Configurations to provision BYOH workload clusters should be validated in case of invalid configuration input. |
| 144 | +3. Configurations to provision BYOH workload clusters should be validated in case of invalid configuration input. |
63 | 145 |
|
| 146 | +<!-- References --> |
| 147 | +[cluster-api-book]: https://cluster-api.sigs.k8s.io/ |
| 148 | +[releases]: https://github.com/kubernetes-sigs/cluster-api/releases |
0 commit comments